{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Model"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. toctree::                                               \n",
    "   :maxdepth: 2                                       \n",
    "   :caption: Contents: \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch_struct\n",
    "import torch\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "matplotlib.rcParams['figure.figsize'] = (7.0, 7.0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chain"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.LinearChainCRF "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKo0lEQVR4nO3df6xfd13H8eeL225zQ9iki1zaxs1QQaK4jZsqmVkWx6RDspqIyZagg0huYpiixuimyYj8Nf3DX5FAlq7SKTDMELiSxjqyESQE2C12g210XBuS3m7a0Y5hRTc73v5xT+fd9dt29Hv6Pb2fPh/JN/f8+PS83yc3va+ecz73NFWFJEmr3UuGbkCSpD4YaJKkJhhokqQmGGiSpCYYaJKkJhhokqQmjBVoSX4oyb1JvtF9veg4455Lsqf7zI1TU5KkUTLO76El+RPgcFXdnuQW4KKq+v0R445U1UvH6FOSpBMaN9D2AldX1RN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+ET3Gts1wEeq6h+Hbal3vwF8uLsY2Ae8c8hmzvpp+5KkNnjLUZLUBANNktQEA02S1AQDTZLUBANNktQEA02S1AQDTZLUhP8FQ3EA+AQ/SbIAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C = 3, 7, 2\n",
    "def show_chain(chain):\n",
    "    plt.imshow(chain.detach().sum(-1).transpose(0, 1))\n",
    "\n",
    "# batch, N, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, C, C)\n",
    "dist = torch_struct.LinearChainCRF(log_potentials)\n",
    "show_chain(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAK+UlEQVR4nO3df6xfdX3H8efL3lIQB0VKZkMbYLEhGLcMvHZbMKQZshQl1GQug2QOzUyTRfyxZdlgSzDzj4Uty35lRtOUzrI5ccE570wzhgHjFiPj4uoQsHptnL0FrVIB64Sm8N4f95Rc7r5tWe/53tP76fORfHPP55zPPZ/3SdP7ut9zPt/PTVUhSdJy94qhC5AkqQ8GmiSpCQaaJKkJBpokqQkGmiSpCQaaJKkJiwq0JK9Ocm+Sb3RfzztGv+eT7O5eU4sZU5KkUbKYz6El+RPgYFXdnuQW4Lyq+r0R/Q5V1asWUackSce12EDbA2yqqieSrAU+X1WXjuhnoEmSxmqxgfZUVa3utgP84Gh7Qb8jwG7gCHB7Vf3TMc63FdgKMHHWxBvOvejck67tVHfombOGLmGsXnv+d4cuY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m85SpKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmmCgSZKa8L91rBdGw/nfhQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_chain(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKuElEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pfc77n30+cj+eae8z2fnvf75PZ7Xz3nfO5pqgpJkta7lw3dgCRJfTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU0YK9CSvDLJfUm+0n296BTjnkuyv3vNjVNTkqRRMs7voSX5I+BYVd2R5Fbgoqr63RHjjlfVy8foU5Kk0xo30A4A11TVk0mmgU9X1WtHjDPQJEmratxA+3pVXdgtB3j65PqKcSeA/cAJ4I6q+vtT7G8WmAWYYuoN53HBS+5trfvR139r6BZW1eNfOG/oFqSR/Oytb9/k6a9V1SWjtp0x0JJ8CnjViE2/D+xZHmBJnq6q77qPlmRzVR1O8hrgfuDaqvqP09W9IK+sN+ba0/a2nu17Yv/QLayqt7z68qFbkEbys7e+farufaiqZkZt23CmP1xVbz7VtiT/lWR62SXHI6fYx+Hu68EknwauAE4baJIkfS/GnbY/B9zcLd8M/MPKAUkuSnJut7wJuAp4dM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ND91P35JcmOTeJF9O8liSNw3az9l+Dy3JFPA4cB2wCDwI3FRVjw7aWE+SXA0cB+4e9TuC612SaWC6qj6f5AeAh4Cfa+H7180MPr/7/c2NwL8A76mqzw7cWq+S/BYwA1zQ2uPxknwVmKmqJn8pPskelh5ruCvJOcB5VfX1ofrxDA22AwtVdbCqngXuAXYO3FNvWn8sWVU9WVWf75a/CTwGbB62q37UkuPd6sbu1dS/QJNsAX4W2DV0L/reJHkFcDVwF0BVPTtkmIGBBks//A4tW1+kkR+IZ5vuaTVXAJ8btpP+dJfj9gNHgPuqqplj6/wp8DvAd4ZuZJUU8E9JHuoe7deSy4CngL/sLhnvSnL+kA0ZaGpCkpcDHwN+o6q+MXQ/famq56rqcmALsD1JM5eNk7wNOFJVDw3dyyr6qaq6ErgeeHd3C6AVG4ArgQ9U1RXAfwODzkEw0OAwsHXZ+pbuPa0T3f2ljwEfrqq/G7qf1dBdynkA2DF0Lz26Crihu890D/DTSf562Jb6VVWHu69HgI+zdIujFYvA4rKrBveyFHCDMdCWJoFsS3JZd1PzRmBu4J70InUTJ+4CHquqPx66nz4luSTJhd3y97M0cenLw3bVn6q6raq2VNWlLH3u7q+qXxy4rd4kOb+bqER3Ke5ngGZmG1fVfwKHkry2e+taYNDJWJP872PWpKo6keQWYB8wBewe9V/brFejHktWVXcN21WvrgJ+Cfhid68J4Pe6h2Cvd9PAnm4m7suAv62q5qa2N+wHgY93j7HdAPxNVf3jsC317teAD3cnAweBdw7ZzFk/bV+S1AYvOUqSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmvD/my0Jz0FU+nEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "event = dist.to_event(torch.tensor([[0, 1, 0, 1, 1, 1, 0, 1]]), 2)\n",
    "show_chain(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hidden Markov Model"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.HMM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAAClCAYAAAA0yQjMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKjUlEQVR4nO3dbYxeZZ3H8e/PtoCgrigEa9sIG7v4LOqk6wZjiIoWNNRkNYFERaNpYiQ+vVCICUZf4b5wd41GQ5AgagSDmp3FahcDGzW7SActaMHiSEw6FVNtFSU+YPHvizlDhund1vQ+3md6zfeT3JnzcM25/r1yMr/73Oe6T1NVSJJ0vHvc0AVIktQHA02S1AQDTZLUBANNktQEA02S1AQDTZLUhLECLclTktyS5Cfdz1MP0+6RJDu71/Q4fUqSNErG+R5akn8DDlTVVUkuB06tqg+OaPdQVT1hjDolSTqicQNtN3BeVT2QZC3wv1V19oh2Bpok6e9q3HtoZ1TVA93yL4AzDtPupCQzSW5P8vox+5Qk6RCrj9YgybeAp43Y9aHFK1VVSQ53ufeMqtqb5B+BW5P8sKp+OqKvrcBWgFNOzkue9cwTjvoPaNl9d588dAmD+6cX/H7oEgbneeB5sMBzAX7Hr39VVaeP2jeRjxyX/M51wM1VddOR2k298KS6Y/uGY66tBa95+jlDlzC47T/fOXQJg/M88DxY4LkA36qb7qyqqVH7xv3IcRq4tFu+FPivpQ2SnJrkxG75NOBc4J4x+5Uk6THGDbSrgPOT/AR4VbdOkqkk13Rtng3MJLkLuA24qqoMNElSr456D+1Iqmo/8MoR22eAd3TL/wc8f5x+JEk6Gp8UIklqgoEmSWqCgSZJaoKBJklqg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cyhCQ/S/LD7vGFM0PXM4ofOS6RZBVwH3A+MAfsAC6pqnsGLWzCkrwceAi4/m/5KkaLkqwF1lbV95M8EbgTeP1KOhe62cmndN8hXQN8F3hPVd0+cGkTl+T9wBTwpJX4GL/j4etWXqEdahMwW1X3V9XDwA3AloFrmjgfZwZV9UBVfb9b/h1wL7Bu2Komq+Y91K2u6V4r7l1wkvXAa4Frhq5Fh2egHWodsGfR+hwr7I+YDtU9OOBFwPeGrWTyuo/adgL7gFuqasWNAfAfwAeAvwxdyIAK+J8kd3ZPdVp2DDTpKJI8AfgK8N6q+u3Q9UxaVT1SVecA64FNSVbUR9BJXgfsq6o7h65lYC+rqhcDFwDv6m5LLCsG2qH2AhsWra/vtmkF6u4bfQX4YlV9deh6hlRVvwFuAzYPXcuEnQtc1N1DugF4RZIvDFvS5FXV3u7nPuBrzN+eWVYMtEPtADYmOSvJCcDFwPTANWkA3YSIzwL3VtXHh65nCElOT/LkbvnxzE+W+vGwVU1WVV1RVeur6kzm/x7cWlVvGrisiUpySjcxiiSnAK8Glt0MaANtiao6CFwGbGd+EsCXq2rXsFVNXvc4s/8Hzk4yl+TtQ9c0gHOBNzP/jnzhf1u/cOiiJmwtcFuSu5l/s3dLVa3Iaesr3BnAd5PcBdwBfL2qvjlwTYdw2r4kqQleoUmSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmmCgSZKa8FdRd9AzExwEkAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, V, N, C = 10, 3, 7, 2\n",
    "\n",
    "transition = torch.rand(C, C).log_softmax(0)\n",
    "emission = torch.rand(V, C).log_softmax(0)\n",
    "init = torch.rand(C).log_softmax(0)\n",
    "observations = torch.randint(0, V, size=(batch, N))\n",
    "\n",
    "dist = torch_struct.HMM(transition, emission, init, observations)\n",
    "show_chain(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Semi-Markov"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.SemiMarkovCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAGD0lEQVR4nO3cy6uUBRzG8efpnMw0urfxQrnowiG6cegmtMhApaitQi0iaNOdIKq/IaIWEUhZi6IW5iJCMqigTZinC6VZIXbxWJElZRRl1tNiJjDQ5jTO+Jt33u9n5cwZXh5ezjnfM++M4yQCAKDKcdUDAADtRogAAKUIEQCgFCECAJQiRACAUoQIAFBqchgHnecTMl8Lh3FoFDnvol+rJxzRZx8uqJ6AIeB7brz8pl90IL/7cF/zMP4f0ck+PVd4xcCPizqbv/6gesIRrVx0SfUEDAHfc+NlS17X/uw7bIi4NAcAKEWIAAClCBEAoBQhAgCUIkQAgFKECABQihABAEoRIgBAKUIEAChFiAAApQgRAKAUIQIAlCJEAIBShAgAUGpOIbK9yvantnfafnDYowAA7dEzRLYnJD0habWkKUlrbU8NexgAoB3m8ozockk7k+xKckDSi5JuGu4sAEBbzCVEiyXtPuT2bPe+f7F9u+0Z2zN/6PdB7QMAjLmBvVkhybok00mmj9cJgzosAGDMzSVEeyQtPeT2ku59AAActbmEaKukc20vsz1P0hpJLw93FgCgLSZ7PSDJQdt3StosaULS+iTbh74MANAKPUMkSUk2Sdo05C0AgBbikxUAAKUIEQCgFCECAJQiRACAUoQIAFCKEAEAShEiAEApQgQAKEWIAAClCBEAoBQh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8n2ZvkD0kbJV1dvKnMKIdoq6RzbS+zPU+dF/JeLt408mxbnev1O5I8Wr2nKZI8lGRJknPU+V57I0lr/0KdqyTfStpt+/zuXSskfVw4qSm+knSl7QXdn9kVavGbPCarBxxJkoO275S0WZ13lKxPsr14VhMsl3SLpI9sf9C97+Ekmwo3YbzdJen57h+MuyTdWrxn5CXZYnuDpPfUeafr+2rxJyzwyQoAgFKjfGkOANAChAgAUIoQAQBKESIAQClCBAAoRYgAAKUIEQCgFCECAJT6G3Q/W6mlVinSAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C, K = 3, 10, 2, 6\n",
    "def show_sm(chain):\n",
    "    plt.imshow(chain.detach().sum(1).sum(-1).transpose(0, 1))\n",
    "\n",
    "# batch, N, K, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, K, C, C)\n",
    "log_potentials[:, :, :3] = -1e9\n",
    "dist = torch_struct.SemiMarkovCRF(log_potentials)\n",
    "show_sm(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAGcklEQVR4nO3cwYucBx3G8efp7MYmW2u0xkOzwewhtCwFW1lKtejBCqYo9tgGtFCEUrBaRZDqHyAepLSHIoQaRQztIe2hSLCCCl4kdk1Fm6SBmGqysTWxRSNp7Jr08TAjROhkJrMz+c277/dz2pldXh5edva7884wTiIAAKpcUz0AANBuhAgAUIoQAQBKESIAQClCBAAoRYgAAKVmJn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zQN5200nLfRcN5Gx7nj0hwAoBghAgCUakKIdlcPaCjO22g4b6PhvI2u9edu6l8jAgCsb014RgQAWMemOkS2d9o+avuY7Uer9zSB7W22f2X7sO1Dth+p3tQktju2X7L90+otTWF7s+19tl+xfcT2x6o3NYHtr/ceoy/bftr2tdWbqkxtiGx3JD0p6W5Ji5J22V6sXdUIFyR9I8mipDskfZnzdkUekXSkekTDPCHpZ0lulvQRcf4Gsr1V0lclLSW5RVJH0n21q+pMbYgk3S7pWJLjSVYlPSPpnuJNUy/Ja0kO9r7+l7p/FLbWrmoG2/OSPivpqeotTWH7fZI+KekHkpRkNck/alc1xoykjbZnJG2S9NfiPWWmOURbJZ285PaK+IN6RWxvl3SbpAO1SxrjcUnflPRO9ZAGWZB0RtIPe5c0n7I9Vz1q2iU5Jel7kk5Iek3SP5P8vHZVnWkOEdbA9nWSnpX0tSRnq/dMO9ufk3Q6ye+qtzTMjKSPSvp+ktsknZPE67kD2H6/uld4FiTdKGnO9hdqV9WZ5hCdkrTtktvzvfswgO1ZdSO0N8lz1Xsa4k5Jn7f9Z3UvA3/K9k9qJzXCiqSVJP971r1P3TDh8j4t6dUkZ5L8R9Jzkj5evKnMNIfoRUk7bC/Y3qDuC3nPF2+aerat7vX6I0keq97TFEm+lWQ+yXZ1f9d+maS1/6EOK8nrkk7avql3112SDhdOaooTku6wvan3mL1LLX6Tx0z1gH6SXLD9sKQX1H1HyZ4kh4pnNcGdkr4o6Y+2f9+779tJ9hduwvr2FUl7e/8wHpf0QPGeqZfkgO19kg6q+07Xl9TiT1jgkxUAAKWm+dIcAKAFCBEAoBQhAgCUIkQAgFKECABQihABAEoRIgBAKUIEACj1X1KcXoFblDjPAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_sm(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAABtCAYAAADjwmW6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAGF0lEQVR4nO3cz4ucBx3H8ffH3aYxEbRoL/mBzaFWFrGtLLVa8GCEpij22oAeROjF1iqCVP8GET0UIdTowdIeYg9FgitUwYvErm3QprESojabVppatFKxafTrYUdIIXE225l859l5v06ZmeXhw0Nm3zvPDJOqQpKkLu/oHiBJmm+GSJLUyhBJkloZIklSK0MkSWpliCRJrRancdBtuba2s3Mah1aTD3z4n90TLusPv93RPUHSGP/idc7XG7nUY1MJ0XZ28tHsn8ah1WRl5Xj3hMu6c9ct3RMkjXGsnrzsY16akyS1MkSSpFaGSJLUyhBJkloZIklSK0MkSWpliCRJrQyRJKmVIZIktTJEkqRWhkiS1MoQSZJaGSJJUitDJElqtaEQJTmQ5Pkkp5I8OO1RkqT5MTZESRaAh4C7gCXgYJKlaQ+TJM2Hjbwiug04VVWnq+o88Bhw93RnSZLmxUZCtBs4c9HttdF9b5Hk3iSrSVbf5I1J7ZMkbXET+7BCVR2qquWqWr6Gayd1WEnSFreREJ0F9l50e8/oPkmS3raNhOgp4MYk+5JsA+4BnpjuLEnSvFgc9wNVdSHJfcAKsAAcrqoTU18mSZoLY0MEUFVHgaNT3iJJmkN+s4IkqZUhkiS1MkSSpFaGSJLUyhBJkloZIklSK0MkSWpliCRJrQyRJKmVIZIktTJEkqRWhkiS1MoQSZJapaomftDlm7fXr1f2jv9BvcWdu27pnqA5s/Li8e4Jg+Rz9codqyd5rV7NpR7zFZEkqZUhkiS1MkSSpFaGSJLUyhBJkloZIklSK0MkSWpliCRJrQyRJKmVIZIktTJEkqRWhkiS1MoQSZJaGSJJUitDJElqZYgkSa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ASusf6LkcFWdaJ41BHcAnwd+l+T46L5vVtXRxk3a2u4HHhn9wXga+ELznplXVceSHAGeZv2Trs8wx9+w4DcrSJJazfKlOUnSHDBEkqRWhkiS1MoQSZJaGSJJUitDJElqZYgkSa0MkSSp1X8BA3VRlcLq6DEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Use -1 for segments.\n",
    "event = dist.to_event(torch.tensor([[0, 1, -1, 1, -1, -1, 0, 1,  1, -1, -1]]), (2, 6))\n",
    "show_sm(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Alignment"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.AlignmentCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAFECAYAAAByNKo5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAARBElEQVR4nO3dfYwtd1kH8O9jL4i8CMUqL21DCyFNkKjUDQFEJBaxYEPREFMiWKDJDVEUDIRUSQjxH0UUXwnkChU0pDTyIg0BoSIJMaGVe0tfKdCCvLSWFqwBlD+g8vjHnttst2f3bvfM3fPbns8nOdk5M78z88zO3PO9M/PbmeruAMBofmjZBQDAPAIKgCEJKACGJKAAGJKAAmBIAgqAIR3Yy4XVSdU5bbr5/eyR6ebF7tgEwAS+2d0/vnnkngZUTktyeLrZHa7p5sXu2ATABL4yb6RTfAAMSUABMCQBBcCQBBQAQ1oooKrq7Kr6fFXdVFU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a/8+j+v6HtkNtgu5c7SQAwJJ0kABiSgAJgSAIKgCEJKACGJKAAGJKAAmBIAgqAIQkoAIb0/x8JqXOXioS6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, M = 3, 15, 20\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, M, 3)\n",
    "dist = torch_struct.AlignmentCRF(log_potentials)\n",
    "show_deps(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAFECAYAAAByNKo5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAUtUlEQVR4nO3dfYxlB1nH8e8zs29tKXRroZS22kJIEyQKzQRREY1FLEgoGmLa+FKEZEMUBYOSKoka//L93WhWqKA2hciLNASklZcQE6hsSwstLbRAga19taXb7m53Xu7jH3N3M0zvzE7nPjvzDPf7SSZz7znnPvc5c869vznnnntOZCaSJHUztdkNSJI0igElSWrJgJIktWRASZJaMqAkSS0ZUJKklrZt5JPFGZGcV1fv3Bvqah2oKwXAkcJaC4W1AAZNawH4pQdpIj2YmU9fPnBDA4rzgM/Vlfvtwu2/a+tKAfD1wloPF9YCONS0FtSGcXXYVYexpGO+MWqgu/gkSS0ZUJKklgwoSVJLBpQkqaWxAioiLo6IL0fEnRFxRVVTkiStO6AiYhr4e+AVwPOAyyLieVWNSZIm2zhbUC8C7szMr2XmLPAe4JKatiRJk26cgDob+NaS+/uHwyRJGtsJP0giIvZExL6I2McDJ/rZJEnfLcYJ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GlCSpJQNKktSSASVJasmAkiS1ZEBJklr6fyhX0UATAH3bAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Dependency Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.DependencyCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANYUlEQVR4nO3dz6vdB5nH8c8zuWlq6ow6zGySlGkXjkORmVQutVpw0QrRUexmFhUUxk02o1YRpM7Gf0BEFyKEqhuLXcQuRIpx8MdiNsG0DWgbhVKdNk3FDsNYqUyT4jOL3Bk6JfGeO9wn55yb1wsCueecHD58k5t3vt9z7k11dwBgt/3JsgcAsDcJDAAjBAaAEQIDwAiBAWDExsST3lAH+sbcNPHUAKyQ/8rLudiv1JXuGwnMjbkp76x7Jp4agBVyun9w1ftcIgNghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjFgpMVb2vqn5RVU9X1QPTowBYf9sGpqr2JflKkvcnuS3Jh6vqtulhAKy3Rc5g7kjydHc/090Xkzyc5N7ZWQCsu0UCczjJc6/5+PzWbf9HVR2vqjNVdeZSXtmtfQCsqV17kb+7T3T3Zndv7s+B3XpaANbUIoF5PsnNr/n4yNZtAHBViwTm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gARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjFg5MVe2rqieq6ruTgwDYG3ZyBnN/knNTQwDYWxYKTFUdSfKBJA/OzgFgr1j0DOZLST6b5A+DWwDYQ7YNTFV9MMlvuvuxbR53vKrOVNWZS3ll1wYCsJ4WOYO5K8mHqupXSR5OcndVffP1D+ruE9292d2b+3Ngl2cCsG62DUx3f667j3T3LUnuS/LD7v7I+DIA1pqvgwFgxMZOHtzdP07y45ElAOwpzmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARO/puyrAKTl04u+wJV3Ts0NFlT4CV4gwGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjNhY9gDYqWOHji57whWdunB22ROuyjHbmVU9XuvGGQwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjFgoMFX15qo6WVU/r6pzVfWu6WEArLdF/8OxLyf5Xnf/Q1XdkOTg4CYA9oBtA1NVb0ryniT/mCTdfTHJxdlZAKy7RS6R3ZrkxSTfqKonqurBqrrp9Q+qquNVdaaqzlzKK7s+FID1skhgNpK8I8lXu/v2JC8neeD1D+ruE9292d2b+3Ngl2cCsG4WCcz5JOe7+/TWxydzOTgAcFXbBqa7f53kuap629ZN9yR5anQVAGtv0XeRfSLJQ1vvIHsmycfmJgGwFywUmO4+m2RzeAsAe4iv5AdghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYs+u36gW0cO3R02RPWzqoes1MXzi57whWt6vG6GmcwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAAD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XXXsrGZgkdyR5uruf6e6LSR5Ocu+SN62s7n6hux/f+vnvcvmT//ByV622qjqS5ANJHlz2llVXVW9K8p4kX0uS7r7Y3f+53FVrYSPJG6pqI8nBJBeWvOeaW9XAHE7y3Gs+Ph9/YS6kqm5JcnuS08tdsvK+lOSzSf6w7CFr4NYkLyb5xtYlxQer6qZlj1pl3f18ki8keTbJC0l+293fX+6qa29VA8P/Q1W9Mcm3k3yqu19a9p5VVVUfTPKb7n5s2VvWxEaSdyT5anffnuTlJF4X/SOq6i25fNXl1iSHktxUVR9Z7qprb1UD83ySm1/z8ZGt27iKqtqfy3F5qLsfWfaeFXdXkg9V1a9y+fLr3VX1zeVOWmnnk5zv7v85Kz6Zy8Hh6t6b5Jfd/WJ3X0rySJJ3L3nTNbeqgflJkrdW1a1VdUMuvzj2nSVvWllVVbl8ffxcd39x2XtWXXd/rruPdPctufxn64fdfd3963JR3f3rJM9V1du2bronyVNLnLQOnk1yZ1Ud3Pr8vCfX4RsjNpY94Eq6+9Wq+niSU7n87ouvd/eTS561yu5K8tEkP62qs1u3/XN3P7rETewtn0jy0NY/+J5J8rEl71lp3X26qk4meTyX3+X5RK7DbxvjW8UAMGJVL5EBsOYEBoARAgPACIEBYITAADBCYAAYITAAjPhvXP4jKSKlj+4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, N = 3, 10, 10\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N)\n",
    "dist = torch_struct.DependencyCRF(log_potentials)\n",
    "show_deps(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAA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wQAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPAiLUDU1U7VfXpqvqtyUEAHAxXcgXzriQnp4YAcLCsFZiqujPJjyR5/+wcAA6Kda9gfinJLyQ5P7gFgAPksoGpqh9N8mx3f+oy97uvqk5U1YnT51/Yt4EAbKd1rmDemOQtVfV4kg8meVNVfeBb79Td93f38e4+fvjQDfs8E4Btc9nAdPd7uvvO7r4ryb1JPt7dbx9fBsBW83MwAIzYvZI7d/cnk3xyZAkAB4orGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYMQV/TbltXUnL744cuir0efOLT1hpUMbuutvPXBm6Qkrve6/fG7pCSt941+9YekJe3r8rbcsPWGlY//5r5aesNrh65ZesNKhG29eesKlvrSz502uYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8CI3ZGjVpKdnZFDX5XupResdP7Lp5aesFK9/MalJ6x04h1/f+kJKx39j59besKezv371yw9YaUvv2/mn6CrddtP3rD0hJXO3XrT0hMu0c/u/W+9KxgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGLFWYKrqlqp6sKr+qKpOVtUPTA8DYLut+2o/v5zko939j6vqcJIjg5sAOAAuG5iqujnJDyb550nS3aeTnJ6dBcC2W+chsmNJTiX5jar6dFW9v6oueS3dqrqvqk5U1YnT5/9q34cCsF3WCcxuktcl+dXufm2S55O8+1vv1N33d/fx7j5++ND1+zwTgG2zTmCeTPJkdz988e0HcyE4ALCnywamu59J8sWqes3Fd92T5LHRVQBsvXWfRfbTSR64+AyyLyR5x9wkAA6CtQLT3Z9Jcnx4CwAHiJ/kB2CEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARqz76/qvSJ87n/Nff37i0AfSoZe9bOkJK9XuyF+Pq3boiaeXnrDSV955+9IT9vTsv9jMlzF/1X+4aekJK133geeWnrDSmfds4Odk1Z43uYIBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIwQGABG7I4ctTt95uzIoa9G7ewsPWGl7l56wmpnN+9jmCTnv/780hNWqs89vvSEPb36Xx9desJKf/EPbll6wkqH3nvH0hNWeuHOw0tPuMT5x/a+TnEFA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAj1gpMVf1cVT1aVX9YVb9ZVddPDwNgu102MFV1R5KfSXK8u783yU6Se6eHAbDd1n2IbDfJDVW1m+RIki/NTQLgILhsYLr7qSS/mOSJJE8nea67f+db71dV91XViao6cSYv7v9SALbKOg+RfXuStyY5luT2JDdW1du/9X7dfX93H+/u49flZfu/FICtss5DZD+U5E+6+1R3n0nyUJI3zM4CYNutE5gnkry+qo5UVSW5J8nJ2VkAbLt1vgfzcJIHkzyS5LMX/5/7h3cBsOV217lTd783yXuHtwBwgPhJfgBGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYMRav035StUN1+fQ33n1xKGvyqFTX116wkp94w1LT1ipnn9h6QkrHbrl5qUnrNTf2MzzlST14umlJ6z04i2b+TXubT/x1NITVvq3r/pvS0+4xD997Nk9b9vMjy4AW09gABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGCEwAIw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XxvhVMQCM2NSHyADYcgIDwAiBAWCEwAAwQmAAGCEwAIwQGABG/B+Av7iAfR9xpgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAANn0lEQVR4nO3b34ulB33H8c+3u2tioiJtU0myofHCCiJ1U4b0IlJoim7UoL1U0CthbypEWhC99B8Qb3qzaGiL1iDEgFjrGjQiAU3cxDU1PwxBUkwU1h+IptL88tuLHdsYN50jzPc8c868XjDszJ6Hk8/DbvY9zznPVHcHAPbbHyw9AIDtJDAAjBAYAEYIDAAjBAaAEUcnnvRldUlfmssnnhoOrD/7818tPWFRjz5w2dITWMB/57/yTD9dF3tsJDCX5vL8Zf3NxFPDgXXmzLmlJyzq5FUnlp7AAu7pr7zkY14iA2CEwAAwQmAAGCEwAIwQGABGCAwAIwQGgBECA8AIgQFghMAAMEJgABghMACMEBgARggMACMEBoARAgPACIEBYITAADBCYAAYITAAjBAYAEYIDAAjBAaAEQIDwAiBAWCEwAAwQmAAGLFSYKrqpqr6XlU9VlUfnh4FwObbMzBVdSTJPyZ5W5I3JHlPVb1hehgAm22VK5jrkzzW3d/v7meS3JbkXbOzANh0qwTm6iQ/eMHXT+z+3m+pqlNVdbaqzj6bp/drHwAbat/e5O/u09290907x3LJfj0tABtqlcA8meSaF3x9fPf3AOAlrRKYbyV5XVW9tqpeluTdST4/OwuATXd0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oeT7LT3Qfyh0y36Qrm+iSPdff3u/uZJLcledfCm9amu7+e5GdL71hCd/+ou+/f/fyXSR5OcvWyq9ajL3hq98tjux/b8V3jCqrqeJJ3JPnE0lv4XdsUmKuT/OAFXz+RQ/KPDP+nqq5Ncl2Se5Zdsj67LxGdS3I+yZ3dfWjOPcnHk3woya+XHrKQTvLlqrqvqk4tPebFtikwHHJV9Yoktyf5YHf/Yuk969Ldz3f3iSTHk1xfVYfiJdKqujnJ+e6+b+ktC3pzd/9Fkrcl+bvdl8oPjG0KzJNJrnnB18d3f49DYPf9h9uTfLq7P7f0niV098+T3JXkpqW3rMkNSd65+z7EbUlurKpPLTtpvbr7yd1fzye5IxfeKjgwtikw30ryuqp6bVW9LMm7k3x+4U2swe4b3Z9M8nB3f2zpPetUVVdU1at3P395Ltzk8siyq9ajuz/S3ce7+9pc+P/9q9393oVnrU1VXb57U0uq6vIkb01yoO4i3ZrAdPdzST6Q5EwuvMn72e5+cNlV61NVn0nyjSSvr6onqur9S29aoxuSvC8XvoM9t/vx9qVHrcmVSe6qqgdy4ZusO7v70N2ue0i9JsndVfWdJPcm+bfu/tLCm37L1tymDMDBsjVXMAAcLAIDwAiBAWCEwAAwQmAAGCEwAIwQGABG/A9gCmL7XTdKRwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Convert from 1-index standard format. (Head is 0)\n",
    "event = dist.to_event(torch.tensor([[2, 3, 4, 1, 0, 4]]), None)\n",
    "show_deps(event[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Non-Projective Dependency Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.NonProjectiveDependencyCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAGbCAYAAAD5r4b7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAQX0lEQVR4nO3df6zddX3H8feb3gKlMIGBU35k1M0pBKO4G4c00UTcomI02ZYMF8nmPywRFYmJ0SWL2zL+c4pmxoig+0OjWQrJnDEKmxLjsiDlR0QoLgwFihggCEJBbn+890e7hNHvtae2737OaR+PhKT3nsM3r3zTe5/9nnPuPVlVAQAH21GjBwBweBIYAFoIDAAtBAaAFgIDQIuljoOuWb++1p50csehD8jSM6MXTNuxbvSCVeToAdOOWhm9YNrSs7tGT1jVc6eOXjDt9PVPjJ4w6afPnDh6wqRamb9rgh2PPx47t22b/G7REpi1J50cZ152RcehD8hv/mA+X5L987Pn7y9NRMTOY+fzfB1//+gF0075wbOjJ6zqvstGL5j2D7//r6MnTPq7H7x99IRJ2+9fP3rCXh765FWr3jaf39kAWHgCA0ALgQGghcAA0EJgAGghMAC0EBgAWggMAC0EBoAWAgNAC4EBoIXAANBCYABoITAAtJgpMJn5lsz8UWbem5kf6R4FwOLbZ2Ayc01EfCYi3hoR50TEuzLznO5hACy2Wa5gXhcR91bVfVW1EhFfjYh39s4CYNHNEpjTI+LB5328dc/n/p/MvDQzN2fm5p3bth2sfQAsqIP2JH9VXV1Vy1W1vGb9/L2tJwCH1iyBeSgiznzex2fs+RwArGqWwNwSES/PzA2ZeXREXBwRX+udBcCiW9rXHapqR2a+LyK+FRFrIuILVXVX+zIAFto+AxMRUVXfiIhvNG8B4DDiJ/kBaCEwALQQGABaCAwALQQGgBYCA0ALgQGghcAA0EJgAGghMAC0EBgAWggMAC0EBoAWM/025f1VaytWXrq949AH5Nlznx49YdLR3zl59IRJ5//5HaMnTLr1868ZPW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YHRxW9+aI+HFVPVpV2yPi+oi4YPCmQ25eA3NLRLw8Mzdk5tGx+8mxrw3eNLcyM2P34+NbquoTo/fMu6r6aFWdUVVnxe6/W9+uqiPuX5ezqqqfRcSDmfmKPZ+6MCLuHjhpETwQEedn5nF7vj4vjCPwhRFLowdMqaodmfm+iPhW7H71xReq6q7Bs+bZxoi4JCLuzMw79nzur6vqGwM3cXh5f0R8ec8/+O6LiPcM3jPXqurmzNwUEbfF7ld53h5H4K+N8atiAGgxrw+RAbDgBAaAFgIDQAuBAaCFwADQQmAAaCEwALT4X5/BxRCMPrt+AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, N = 3, 10, 10\n",
    "def show_deps(tree):\n",
    "    plt.imshow(tree.detach())\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N)\n",
    "dist = torch_struct.NonProjectiveDependencyCRF(log_potentials)\n",
    "show_deps(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Binary Labeled Tree"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.TreeCRF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAXIElEQVR4nO3dbaxdZ3nm8f81cUJEmoQYQ8jb8NJEkZhqcJFlyAytwoTmxUKEtkwnUTUNhZFLp0hlNKjKDBIg5sswFUVqg0hd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te9qP6XDXXdP9R4eN8vrj/Ah4afzZeALWtd95I/wyksBM7pi9a13P8shOiTwA9Z+CzjrSx8lvpZ4BHg/wIbh75bgI8seu9bhuN/D/Cbjerfw8JnNIeP/8N3254N7Dzacdag9j8djukHWAids5bWPrw+4vdTh/qH9R89fKwv6ttq3y/38KuOJEktdb/EJ0lapwwoSVJLBpQkqSUDSpLUkgElSWrJgJIktWRASZJa+v9hT35d46IPlAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, NT = 3, 20, 3\n",
    "def show_tree(tree):\n",
    "    t = tree.detach()\n",
    "    plt.imshow(t[ :, : , 0] + \n",
    "               2 * t[ :,:, 1] +\n",
    "               3 * t[ :,:, 2])\n",
    "\n",
    "log_potentials = torch.rand(batch, N, N, NT)\n",
    "dist = torch_struct.TreeCRF(log_potentials)\n",
    "show_tree(dist.argmax[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAaM0lEQVR4nO3df5RfdX3n8dcrkx9IDCaRFSGhgpXioZ6ScrKp7GIPFsSQw4HqsTVpd8VCG39Aq21Zy+Iuetx/ZFu1R6FiKjmAy8Zs1dicGpXU9izSFSRyAgSIJmIqSZAUgwmYnzN57x9z4/ky+X5nhvm+yby/M8/HOXPmfu+93/d9f+/cfF9z79x8P44IAQBQzZTxbgAAgHYIKABASQQUAKAkAgoAUBIBBQAoaep4N9DOzDnTY/ZpJ6bU2rNzVkodSeo7OJBW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suOvS7q/zeLzbT9k++u2f/W4NjaykHS37e/ZXt5m+Wh+PhUsVed/oJX3/ykR8VQz/RNJp7RZp1d+Bldp8Gy7nZGOs/FybXN5cmWHy6u9sO/fJOnpiNjSYXnVfS+pfkD1PNsvl/RlSR+MiL1DFj+owctO50r6jKSvHu/+RnBBRJwn6VJJ19j+zfFu6MWyPV3S5ZL+rs3i6vv/F2LwekxP/p8Q2x+W1C/prg6rVDzOPivplyUtkPSUBi+T9aJlGv7sqeK+/4XqAbVD0uktj+c389quY3uqpFdI+ulx6W4EtqdpMJzuioivDF0eEXsj4vlmep2kabZPPs5tdhQRO5rvuySt0eAljVaj+fmMt0slPRgRTw9dUH3/S3r66CXT5vuuNuuU/hnYfrekyyT9fhOyxxjFcXbcRcTTETEQEUck/W2Hnqrv+6mS3i5pdad1Ku77VtUD6gFJZ9k+s/lNeKmktUPWWSvp6J1L75D0T53+IRxPzbXf2yQ9HhGf7LDOq4/+vcz2Ig3+PKqE60zbs45Oa/AP3puGrLZW0ruau/neKGlPyyWpKjr+Bll5/zdaj+0rJf19m3W+KekS23Oay1CXNPPGne3Fkj4k6fKI2NdhndEcZ8fdkL+lvk3texrN+9N4uljS5ojY3m5h1X3/AuN9l8ZIXxq8U+wHGrxb5sPNvI9p8KCXpBM0ePlmq6TvSnrtePfc9HWBBi/JPCxpY/O1RNJ7Jb23WedaSY9q8O6f+yT9h/Huu6X/1zZ9PdT0eHTft/ZvSbc0P5tHJC0c776HvIaZGgycV7TMK7n/NRiiT0k6rMG/ZVytwb+lfkvSFkn/KGlus+5CSZ9vee5VzfG/VdIfFOp/qwb/RnP0+D96t+1pktYNd5wV6P0LzTH9sAZD59ShvTePj3l/qtB/M//2o8d6y7ql9v1IX3zUEQCgpOqX+AAAkxQBBQAoiYACAJREQAEASiKgAAAlEVAAgJIIKABASf8fm9BHxJVGOIwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_tree(dist.marginals[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Probabilistic Context-Free Grammar"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.SentCFG"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch, N, NT, T = 3, 20, 3, 3\n",
    "def show_prob_tree(tree):\n",
    "    t = tree.detach().sum(-1).sum(-1)\n",
    "    plt.imshow(t[ :, : , 0] + \n",
    "               2 * t[ :,:, 1] +\n",
    "               3 * t[ :,:, 2])\n",
    "\n",
    "terminals = torch.rand(batch, N, T)\n",
    "rules = torch.rand(batch, NT, NT+T,  NT+T)\n",
    "init = torch.rand(batch, NT).log_softmax(-1)\n",
    "\n",
    "dist = torch_struct.SentCFG((terminals, rules, init))\n",
    "term, rules, init = dist.argmax"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAGbCAYAAACRXATDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAWO0lEQVR4nO3df6ylBX3n8fdnGX4Eyq/pKPJrq1ZKQps6JZNBd2mDi+XHhEjbsC2k2WIlmdotSU3WNOyaoHH/Wbexzboa6VQI2LhI1hZLtlNhSptQE0BHMvxSlJHQMAMyi+MOIq0y+t0/7jPmejln7uWeM/d+773vV3Jzn/M8z3nOl3MP9815zuGeVBWSJHXzr5Z7AEmSRjFQkqSWDJQkqSUDJUlqyUBJklpat9wDjHJMjq3jOGEqx/q5X3x5KscB+MYjx0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Zfrh9OTt4w5vboS7vtfBp6vqifHbO963wP9A7XiJfkp4C+B91XVi3M2P8TMaae3Av8T+PxSzzePC6vqfOBy4A+S/MpyD/RaJTkGeBfwv0ds7n7//1jNnI9Zkf9PSJIPAAeBz4zZpePj7JPAzwIbgeeYOU22El3D4Z89dbzvf6x7oPYCZ8+6fNawbuQ+SdYBJwPfXpLp5pHkaGbi9Jmq+qu526vqxap6aVjeDhydZMMSjzlWVe0dvu8D7mTmlMZsC/n5LLfLgYeq6vm5G7rf/8Dzh06ZDt/3jdin9c8gybuBK4DfHiL7Kgt4nC25qnq+qn5YVT8C/nzMTN3v+3XAbwB3jNun430/W/dAfRk4J8mbhv8Svhq4a84+dwGH3rl0FfD34/5FWErDud+bga9V1Z+M2ecNh14vS7KZmZ9Hl7iekOTEQ8vMvOD92Jzd7gJ+Z3g339uAA7NOSXUx9r8gO9//g9mP7WuBvx6xz93AJUlOHU5DXTKsW3ZJLgP+CHhXVb08Zp+FPM6W3JzXUn+d0TMt5PfTcnon8ERV7Rm1set9/xOW+10a830x806xbzDzbpkPDOs+zMyDHuA4Zk7f7Aa+BLx5uWce5rqQmVMyjwC7hq8twHuB9w77XA88zsy7fx4A/s1yzz1r/jcPcz08zHjovp89f4BPDD+bR4FNyz33nH+GE5gJzsmz1rW8/5mJ6HPAK8y8lnEdM6+l3gs8CfwdsH7YdxPwqVnXfc/w+N8N/G6j+Xcz8xrNocf/oXfbngFsP9zjrMHsfzE8ph9hJjqnz519uPyq308d5h/W33rosT5r31b3/Xxf/qkjSVJL3U/xSZLWKAMlSWrJQEmSWjJQkqSWDJQkqSUDJUlqyUBJklr6/xHrOlRT30AIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Rules\n",
    "show_prob_tree(rules[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f1877a1fb70>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAAA2CAYAAACvO2whAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI3klEQVR4nO3df+xVdR3H8ecrUdvQ4RdpSuQ0qln0RwnfmZU5FmjqGvTDNVxbkDZyxcq2VmxuzvkX2qqt1mqELnPOWJpKTacYuv6CBAYIKvJjNGUIKoSxNgt798f5fNnxcs6998s933vOvbwe2909557PPef98XPOffM9P94qIjAzMxt076k7ADMzsyo4oZmZ2VBwQjMzs6HghGZmZkPBCc3MzIaCE5qZmQ2FnhKapKmS1krald5HStq9I2lLeq3pZZtmZmZF1MtzaJLuBg5HxApJy4GRiPhxQbtjEXFOD3GamZm11WtC2wnMjYgDkqYDz0bEpQXtnNDMzGxC9ZrQ/hkR56VpAUfG5lvaHQe2AMeBFRHxaMn6lgJLASbDnI+ecmQn2zSnunXN2VTduqq2iQo7CsyhuZ31mFpHFQ5s1ftIk8e1yuO+yuM0WyFvRMT7ihZ1TGiSngYuLFh0G3BfPoFJOhIRJ11HkzQjIvZLmgmsA+ZFxJ522x2VYmPbyMZHFVb4ClW3rqqJakuZBc3trMfUOqpwYKveR5o8rlUe91Uep9kK2RQRo0WLJnX6bkTML12vdFDS9Nwpx0Ml69if3vdKeha4DGib0MzMzMaj19v21wCL0/Ri4LHWBpJGJJ2dpqcBnwVe6HG7ZmZm79JrQlsBXC1pFzA/zSNpVNKq1OZjwEZJW4FnyK6hOaGZmVmleropZCL5Gtqp8TW0U3M6jelpxdfQTsmgXkNzpRAzMxsKlSQ0SddK2ilpd3rAunX52Z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S1PTWPqT5k36/mtKH9Pnvxvb/XNtGjkO7l0tfmZnZUBiUU45mZmZtOaGZmdlQcEIzM7Oh4IRmZmZDwQnNzMyGghOamZkNBSc0MzMbCv8HK0Bvo/PulHEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Terminals\n",
    "plt.imshow(term[:1])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Autoregressive / Beam Search"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "    .. autoclass:: torch_struct.Autoregressive\n",
    "         :members: sample,sample_without_replacement,greedy_max,beam_topk,greedy_tempmax\n",
    "    .. autoclass:: torch_struct.AutoregressiveModel\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch, N, C, H, layer = 3, 10, 4, 5, 1\n",
    "init = (torch.rand(batch, layer, H), \n",
    "        torch.rand(batch, layer, H))\n",
    "def t(a):                                                                                                                                                                    \n",
    "    return [t.transpose(0, 1) for t in a]\n",
    "\n",
    "def show_ar(chain):\n",
    "     plt.imshow(chain.detach().transpose(0, 1))\n",
    "\n",
    "class RNN_AR(torch.nn.Module):                                                                                                                                                                                       \n",
    "    def __init__(self, sparse=True):                                                                                                                                                                             \n",
    "        super().__init__()                                                                                                                                                                                       \n",
    "        self.sparse = sparse                                                                                                                                                                                     \n",
    "        self.rnn = torch.nn.RNN(H, H, batch_first=True)                                                                                                                                                          \n",
    "        self.proj = torch.nn.Linear(H, C)                                                                                                                                                                        \n",
    "        if sparse:                                                                                                                                                                                               \n",
    "            self.embed = torch.nn.Embedding(C, H)                                                                                                                                                                \n",
    "        else:                                                                                                                                                                                                    \n",
    "            self.embed = torch.nn.Linear(C, H)                                                                                                                                                                   \n",
    "\n",
    "    def forward(self, inputs, state):                                                                                                                                                                            \n",
    "        if not self.sparse and inputs.dim() == 2:                                                                                                                                                                \n",
    "            inputs = torch.nn.functional.one_hot(inputs, C).float()                                                                                                                                              \n",
    "        inputs = self.embed(inputs)                                                                                                                                                                              \n",
    "        out, state = self.rnn(inputs, t(state)[0])                                                                                                                                                               \n",
    "        out = self.proj(out)                                                                                                                                                                                     \n",
    "        return out, t((state,)) \n",
    "\n",
    "    \n",
    "dist = torch_struct.Autoregressive(RNN_AR(), init, C, N)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor(-11.7909, grad_fn=<SelectBackward>)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI8UlEQVR4nO3dX6jeh13H8c/XJG2WTp1/emGSYnuxTcKYqRzqtOBFq6RTcbcruAsRcuO0k4FM77yXoRdDCFtVsGxI14sxqnFoQQYal3VxLs0mpeqattLqmN1WbNf59eIcpUrieXr6PPme5zyvFwTO85zDjw+/5Mk7z3N+eU51dwBgyndNDwBgswkRAKOECIBRQgTAKCECYJQQATDq8CoOelPd3EdzyyoO/Ya97Z0vTU+4rn/44rHpCWwYjwdulP/It/JKv1zX+lyt4v8RfU99f/943bv04y7D+WcvTU+4rjPHT09PYMN4PHCjXOi/yIv9tWuGyEtzAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKCECYNRCIaqq+6rqK1X1ZFV9aNWjANgcu4aoqg4l+UiSdyc5leT+qjq16mEAbIZFnhHdleTJ7n6qu19J8okk71ntLA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bp/cuY9dVNWRbEfooe5+ZHrPmrg7yS9U1T9l+2Xge6rqj2cnrYWrSa52938/634422Hi//fTSf6xu1/o7m8neSTJTw5vGrOfQ/S5JG+tqjuq6qZsfyPvU8Ob9r2qqmy/Xn+luz88vWdddPdvdvfJ7r4923/W/rK7N/ZfqIvq7n9J8nRVvX3nrnuTPDE4aV18Ncm7qurYzmP23mzwRR6HpwdcT3e/WlXvT3I+21eUPNjdl4dnrYO7k7wvyd9X1aWd+36rux8d3MTB9qtJHtr5B+NTSX5peM++190XqurhJI9n+0rXL2SD32HBOysAMGo/vzQHwAYQIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABj1X/K+4UTY2EVvAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "path, scores, _ = dist.greedy_max()\n",
    "show_ar(path[0])\n",
    "print(scores[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[-11.7909, -11.8150, -11.7972]], grad_fn=<ViewBackward>)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dist.log_prob(path.unsqueeze(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI+klEQVR4nO3dXYjl913H8c/X3U22m6r1IRfuAyYXtbIUu5EhVgNeJMqmKva2AXshwt7YNpWCVO+8l6IXRVjaqGBokTQXpUT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XVx6rq8PSmKXs2RFV1IMmHk7wjyckk91XVydlVK+G1JB/o7pNJ3p7kt53bdbk/yeXpESvmj5P8dXf/dJK3xfltq6qOJXlfko3ufmuSA0neNbtqzp4NUZI7kzzZ3U919ytJPp7kncOb9rzufq67H9v6/bey+ZfCsdlVq6Gqjif51SQfmd6yKqrqh5P8YpKPJkl3v9Ld35xdtTIOJnlDVR1MciTJs8N7xuzlEB1L8vTrPr4Sf6Fel6q6LckdSc7PLlkZf5Tkd5P85/SQFXJ7kheS/OnWS5ofqapbpkftdd39TJI/TPL1JM8l+ffu/pvZVXP2coj4PlTVG5N8Isn7u/ul6T17XVX9WpLnu/sL01tWzMEkP5vkT7r7jiTfSeL7uduoqh/J5is8tyc5muSWqvqN2VVz9nKInkly4nUfH9/6HNuoqkPZjNCD3f3w9J4VcVeSX6+qf8nmy8B3V9VfzE5aCVeSXOnu/37W/VA2w8T/75eS/HN3v9DdryZ5OMkvDG8as5dD9Pkkb66q26vqpmx+I++Tw5v2vKqqbL5ef7m7PzS9Z1V09+919/Huvi2b/639bXev7b9QF9Xd30jydFW9ZetT9yR5YnDSqvh6krdX1ZGtP7P3ZI1v8jg4PeBauvu1qnpPknPZvKPkge6+NDxrFdyV5N1J/qmqLm597ve7+5HBTexv703y4NY/GJ9K8pvDe/a87j5fVQ8leSybd7p+MWv8DgveWQGAUXv5pTkA1oAQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwKj/Apf59Twg6QqbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90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40IgINtE54RAXCArXWIquruqvpyVT1eVR+Y3rMJqurGqnq4qh6rqgtVde/0pk1SVYeq6nNV9cnpLZuiql5fVQ9U1Zeq6mJV/fz0pk1QVb+7+2f0i1X10ao6Or1pytqGqKoOJflQknckOZnknqo6ObtqI7yU5P3dfTLJ25O8x7m9IvcmuTg9YsP8SZK/6e6fSfKzcX57qqrjSX4nyanufkuSQ0neNbtqztqGKMltSR7v7ie6+8UkH0vyzuFNa6+7n+nuR3ff/lZ2/lI4PrtqM1TViSS/muTD01s2RVX9WJJfTPKRJOnuF7v7m7OrNsbhJK+pqsNJjiV5enjPmHUO0fEkT77s/UvxF+orUlU3Jbk1ySOzSzbGHyf5vST/NT1kg9yc5Lkkf7b7kuaHq+q66VHrrrufSvJHSb6W5Jkk/9ndfzu7as46h4hXoapem+TjSd7X3c9P71l3VfVrSZ7t7s9Ob9kwh5P8XJI/7e5bk3wnia/n7qGqfjw7r/DcnOSGJNdV1W/MrpqzziF6KsmNL3v/xO7H2ENVHclOhO7v7gen92yI25P8elV9NTsvA99RVX85O2kjXEpyqbv/51n3A9kJEz/cLyX51+5+rru/n+TBJL8wvGnMOofoM0neWFU3V9U12flC3ieGN629qqrsvF5/sbs/OL1nU3T373f3ie6+KTu/1/6+u7f2X6iL6u5/T/JkVb1590N3JnlscNKm+FqSt1fVsd0/s3dmi2/yODw94Eq6+6Wqem+Ss9m5o+S+7r4wPGsT3J7k3Un+parO737sD7r7ocFNHGy/neT+3X8wPpHkN4f3rL3ufqSqHkjyaHbudP1ctvg7LPjOCgCMWueX5gDYAkIEwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo/4bafHyb+MtyE8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAA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y1z2xvntnfOzltzAAwTIgBGrUOIHpgesKac2944t71xbnu38We3779HBMDBtg6viAA4wPZ1iKrq3qr6elU9WVUfnt6zDqrq5qp6rKqeqKrzVXX/9KZ1UlWHquqLVfWZ6S3roqreXFUPV9XXqupCVf309KZ1UFW/tfN79KtV9YmqOjq9acq+DVFVHUry0STvSXIyyX1VdXJ21Vp4JcmHuvtkkncn+XXndlXuT3JhesSa+cMkf9ndP5HkJ+P8dlVVx5P8ZpKt7n5HkkNJ3je7as6+DVGSO5I82d1PdfdLST6Z5L3Dm/a97n62ux/f+fg72f5D4fjsqvVQVSeS/GKSj01vWRdV9UNJfjbJx5Oku1/q7m/Prlobh5O8oaoOJzmW5JnhPWP2c4iOJ7n4ms8vxR+oV6Wqbklye5Izs0vWxh8k+e0k/zk9ZI3cmuT5JH+885bmx6rqhulR+113P53k95N8M8mzSf6tu/9qdtWc/RwiXoeqemOSTyX5YHe/OL1nv6uqX0ryXHd/YXrLmjmc5KeS/FF3357k35P4fu4uquqHs/0Oz61JbkpyQ1X9yuyqOfs5RE8nufk1n5/YeYxdVNWRbEfooe5+ZHrPmrgzyS9X1Tey/TbwXVX1Z7OT1sKlJJe6+79fdT+c7TDx//u5JP/U3c9398tJHknyM8ObxuznEH0+yVur6taqui7b38j79PCmfa+qKtvv11/o7o9M71kX3f073X2iu2/J9n9rf9PdG/s31EV1978kuVhVb9956O4kTwxOWhffTPLuqjq283v27mzwTR6HpwdcSXe/UlUfSHI623eUPNjd54dnrYM7k7w/yVeq6tzOY7/b3Y8ObuJg+40kD+38hfGpJL86vGff6+4zVfVwksezfafrF7PBP2HBT1YAYNR+fmsOgA0gRACMEiIARgkRAKOECIBRQgTAKCECYJQQATDqvwCdTvEWiSpxpwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.beam_topk(5)[:, 0]\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([5, 10, 4])\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAJBklEQVR4nO3dX6jeh13H8c/XJG2WTp1/emGSYnsxJ2G4VA7dtOBFq6RTcbcruAsRcuO0k4FM77yXoRdDCFtVsGxI14sxqnHMggw0W9Zlf9JsUqquaSutjtltsnadXy/OUaoknqdnz5Pvec7zekHgPM9z+PHhl5y8z/OcH8+p7g4ATPm+6QEAbDYhAmCUEAEwSogAGCVEAIwSIgBGHV7FQW+qm/toblnFoQ+0n/ip/5iecF3/8IVj0xOANfbtfCsv90t1rcdWEqKjuSVvrXtXcegD7fz5S9MTruvM8dPTE4A1dqE/ed3HvDQHwCghAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFFCBMAoIQJglBABMEqIABglRACMEiIARi0Uoqq6r6q+UlVPVtX7Vj0KgM2xa4iq6lCSDyR5e5JTSe6vqlOrHgbAZljkGdFdSZ7s7qe6++UkH0nyjtXOAmBTLBKiE0meftXtqzv3/S9VdbaqLlbVxe/kpWXtA+CAW9rFCt19rru3unvrSG5e1mEBOOAWCdEzSW571e2TO/cBwPdskRB9Jskbq+qOqropyTuTfGy1swDYFId3+4TufqWq3p3kfJJDSR7s7ssrXwbARtg1REnS3Y8meXTFWwDYQN5ZAYBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGLXQu28fJOefvTQ94brOHD89PeG6nL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wdcT3e/UlXvTnI+21eUPNjdl4dnrYO7k7wryRer6tLOfb/X3Y8ObuJg+80kD+18w/hUkl8b3rPvdfeFqno4yePZvtL1c9ngd1jwzgoAjNrPL80BsAGECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEb9F7yl4+FoiNS5AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI/ElEQVR4nO3dX6jeh13H8c/XJG3WTjf/9MIkxfZim4QxUzl004IXrZJOxd2u4C5kkBunnQxkeue9DL0YQtiqgmVDul6MUY1jFmSgcVkXt6XZRul0TdvRzjG7rdg/8+vFOUqVpOdpdp58n+c8rxcEznmehx8ffjkn7/M858eT6u4AwJQfmR4AwGYTIgBGCREAo4QIgFFCBMAoIQJg1MFlHPS6ur4P58ZlHBrWypvf9vz0hFf1tS/eMD2BDfGf+X5e7BfqcvctJUSHc2PeXnct49CwVs6cOT894VWdPHJiegIb4mx/5or3eWkOgFFCBMAoIQJglBABMEqIABglRACMEiIARgkRAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjFooRFV1d1V9taoeq6oPLnsUAJtj1xBV1YEkH07yziTHk9xTVceXPQyAzbDIM6LbkzzW3Y9394tJPp7kXcudBcCmWCRER5M88YrPL+3c9n9U1amqOldV517KC3u1D4B9bs8uVuju09291d1bh3L9Xh0WgH1ukRA9meTmV3x+bOc2APihLRKizyV5U1XdWlXXJXl3kk8udxYAm+Lgbg/o7per6n1JziQ5kOS+7r6w9GUAbIRdQ5Qk3f1QkoeW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kF4c3jVnlEH0uyZuq6taqui7bv8j75PCmlVdVle3X6y9294em96yL7v6D7j7W3bdk+2vt77t7Y39CXVR3fzPJE1X1lp2b7kry6OCkdfGNJO+oqht2vmfvygZf5HFwesCVdPfLVfW+JGeyfUXJfd19YXjWOrgjyXuSfKmqzu/c9ofd/dDgJva330ly/84PjI8n+a3hPSuvu89W1QNJHsn2la5fyAa/w4J3VgBg1Cq/NAfABhAiAEYJEQCjhAiAUUIEwCghAmCUEAEwSogAGPXfkibfj/UT1T4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI5UlEQVR4nO3dX4ilh1nH8d/j7jbptmKtzYX7BzcXpbIU3MgQqgEvUmVTFXvbgL0QYW+sTaUgtXe9l6IXRVjaqGBokTQXpUTXogEp6LbbdI3dbBtC1GaTlMRK7T9Mmvp4MaNE2XVOJnP2OWfO5wMDc84ZXn68zOx3z5mXM9XdAYApPzI9AIDNJkQAjBIiAEYJEQCjhAiAUUIEwKjDyzjoW958qE+dPLKMQ79mTzx2dHoCwMb5j3wvL/WLdb3HlhKiUyeP5AsXTi7j0K/Z2WNnpicAbJyL/dc3fMxLcwCMEiIARgkRAKOECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEYJEQCjhAiAUUIEwCghAmDUQiGqqnuq6mtV9WRVfWjZowDYHLuGqKoOJflYknclOZ3k3qo6vexhAGyGRZ4R3Znkye5+qrtfSvKpJO9e7iwANsUiITqe5OlX3L62c9//UlXnqupSVV164Zs/3K99ABxw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VHsh2hB7r7oek9a+KuJL9WVf+c7ZeB766qP5udtBauJbnW3f/9rPvBbIeJ/98vJvmn7n6hu3+Q5KEkPz+8acwqh+iLSd5aVbdX1euy/Yu8zwxvWnlVVdl+vf5qd390es+66O7f6+4T3X0q299rf9PdG/s/1EV19zeSPF1Vb9u5651JHh+ctC6+nuQdVXV052f2ndngizwOTw+4ke5+uarel+RCtq8oub+7rwzPWgd3JXlvkn+sqss79324ux8e3MTB9ttJHtj5D+NTSX5jeM/K6+6LVfVgkkezfaXrl7PB77DgnRUAGLXKL80BsAGECIBRQgTAKCECYJQQATBKiAAYJUQAjBIiAEb9F4ub1RADQqcKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.sample((5,))[:, 0 ]\n",
    "print(out.shape)\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI70lEQVR4nO3dXajkh1nH8d/j7ibbpGp9yYXZXUwuamUpNpFDWg14kShJVextA/aiCHtjayoFqd55L0UvirC0UcHQImkuSomuJQakoNtu07XtZtsS0pdsEkk01PQF81IfL85RUtn1TE5n9jlz5vOBhTNnhj8//uw5352ZP7PV3QGAKT8yPQCAzSZEAIwSIgBGCREAo4QIgFFCBMCow6s46DV1bR/N9as4NEN+7he+Nz3hir76heumJwC7+M98Ny/1i3W5+1YSoqO5Pm+tO1dxaIacOXN+esIV3X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T77q9qX4hfqaVNVNSW5NcnZ2ydr40yR/kOS/poeskZuTPJfkL3Ze0vxwVV0/PWq/6+6nkvxJkm8meSbJf3T338+umrOfQ8QPoapen+TjSd7X3S9M79nvquo3kzzb3Z+b3rJmDif5xSR/3t23JvluEu/n7qKqfiLbr/DcnOTGJNdX1W/Prpqzn0P0VJITr7p9fOd77KKqjmQ7Qvd394PTe9bE7Ul+q6q+nu2Xge+oqr+enbQWLiW51N3/86z7gWyHif/fryb5Wnc/190vJ3kwyS8Pbxqzn0P02SRvrKqbq+qabL+R94nhTfteVVW2X6+/2N0fnN6zLrr7D7v7eHfflO2/a//Q3Rv7L9RFdfe/Jnmyqt608607kzw2OGldfDPJ26rqup2f2TuzwRd5HJ4ecCXd/UpVvSfJmWxfUXJfd18YnrUObk/yriRfrKrzO9/7o+5+aHATB9t7k9y/8w/GJ5K8e3jPvtfdZ6vqgSSPZvtK189ngz9hwScrADBqP780B8AGECIARgkRAKOECIBRQgTAKCECYJQQATBKiAAY9d89ReDbzz0IhAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI7klEQVR4nO3dXajkh1nH8d/j7ibbpGp9yYXZXUwuamUpNpFDWg14kShJVextA/aiCHtjayoFqd55L0UvirC0UcHQImkuSomuJQakoNtu07XtZtsS0pdsEkk01PQF81IfL85RUtn1TE5n9jlz5vOBhTNnhj8//uzZ787MnznV3QGAKT8yPQCAzSZEAIwSIgBGCREAo4QIgFFCBMCow6s46DV1bR/N9as4NMC4n/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I0nS3S9197dmV62Nw0leV1WHk1yX5OnhPWP2c4iOJXnyVbcvxT+or0lV3ZTk1iRnZ5esjT9N8gdJ/mt6yBq5OclzSf5i5yXND1fV9dOj9rvufirJnyT5ZpJnkvxHd//97Ko5+zlE/BCq6vVJPp7kfd39wvSe/a6qfjPJs939uekta+Zwkl9M8ufdfWuS7ybxfu4uquonsv0Kz81JbkxyfVX99uyqOfs5RE8lOfGq28d3vscuqupItiN0f3c/OL1nTdye5Leq6uvZfhn4jqr669lJa+FSkkvd/T/Puh/Idpj4//1qkq9193Pd/XKSB5P88vCmMfs5RJ9N8saqurmqrsn2G3mfGN6071VVZfv1+ovd/cHpPeuiu/+wu493903Z/rv2D929sf9DXVR3/2uSJ6vqTTvfujPJY4OT1sU3k7ytqq7b+Zm9Mxt8kcfh6QFX0t2vVNV7kpzJ9hUl93X3heFZ6+D2JO9K8sWqOr/zvT/q7ocGN3GwvTfJ/Tv/YXwiybuH9+x73X22qh5I8mi2r3T9fDb4ExZ8sgIAo/bzS3MAbAAhAmCUEAEwSogAGCVEAIwSIgBGCREAo4QIgFH/DYXp4Nv1x4GpAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAI90lEQVR4nO3dX4ilh1nH8d/j7jbptmLV5sL9g5uLWlmKbmQI1YAXqbKpir1twF6IsDe2plKQ6p33UvSiCEsbFQwtkuailOhaNCAF3XabrrGbbUuIttkkkqjU/sOkqY8XM0qUXedkds4+58z5fGBhzpzh5cc7Z/e758zLmeruAM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ZVXNWNkRJ7k7yVHc/3d0vJ/l4kncNb1p53f18dz++8/E3s/2PwvHZVeuhqk4k+cUkH5nesi6q6geS/GySjyZJd7/c3V+fXbU2Did5fVUdTnI0yXPDe8ascoiOJ3nmVbevxT+or0lVnUpyV5KLs0vWxu8n+a0k/zk9ZI3cmeTFJH+085LmR6rqDdOjVl13P5vk95J8LcnzSf69u/9ydtWcVQ4RN6Gq3pjkE0ne393fmN6z6qrql5K80N2fn96yZg4n+akkf9jddyX5dhI/z91FVf1gtl/huTPJsSRvqKpfmV01Z5VD9GySk6+6fWLnc+yiqo5kO0IPdfcj03vWxD1Jfrmq/inbLwPfW1V/OjtpLVxLcq27//tZ98PZDhP/v59L8o/d/WJ3fzfJI0l+ZnjTmFUO0eeSvKWq7qyq12X7B3mfHN608qqqsv16/dXu/tD0nnXR3b/d3Se6+1S2H2t/3d0b+z/URXX3Pyd5pqreuvOpdyR5cnDSuvhakrdX1dGdv7PvyAZf5HF4esCNdPcrVfXeJBeyfUXJg919ZXjWOrgnyXuS/ENVXd753O9096ODmzjY3pfkoZ3/MD6d5FeH96y87r5YVQ8neTzbV7p+IRv8DgveWQGAUav80hwAG0CIABglRACMEiIARgkRAKOECIBRQgTAKCECYNR/Abt91R2jlDblAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "out = dist.sample_without_replacement((5,))[:, 0]\n",
    "for i in range(3):\n",
    "    show_ar(out[i])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaIAAAC7CAYAAAAnpZqIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIG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21fUP3StpK2JkzrFW5IW2p5U/569VhW+yKM7e0CRiBi2fZukZ1S7omR1RGxJntUJFkm6WdKrtjfXP/aDiFifuAnj23ckran/wrhT0reS95ReRGy0vVbSJtWudH1ZFX6GBZ5ZAQCQqswPzQEAKoAQAQBSESIAQCpCBABIRYgAAKkIEQAgFSECAKQiRACAVP8GWSIR+jwYmoAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "dist = torch_struct.Autoregressive(RNN_AR(sparse=False), init, C, N)\n",
    "_, _, logits = dist.greedy_tempmax(1.0)\n",
    "show_ar(logits[0])\n",
    "loss = logits[0:1, torch.arange(10), torch.zeros(10).long()]\n",
    "loss.sum().backward()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Base Class"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: torch_struct.StructDistribution\n",
    "   :members:  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKvElEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pf0e+793Ocj+eaeH5+e9/vkfntf/Z7zuaepKiRJWuteNnQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXB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TDoZKxJ/vcxq1JVnUhyC7APmAJ2j/qvbdaqUY8lq6q7hu2qV1cBvwR8sbvXBPB73UOw17ppYE83E/dlwN9WVXNT2xv2g8DHu8fYbgD+pqr+cdiWevdrwIe7DwMHgXcO2cy6n7YvSWqDlxwlSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU34f4mjByhWlIcCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKqUlEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pf0e+793Ocj+eaeH5+e9/vktt9Xv+d87rmpKiRJWuteNnQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNWGsQEvyyiT3JflK9/WiU4x7Lsn+7jU3Tk1JkkbJOD+HluSPgGNVdUeSW4GLqup3R4w7XlUvH6NPSZJOa9xAOwBcU1VPJpkGPl1Vrx0xzkCTJJ1V4wba16vqwm45wNMn11eMOwHsB04Ad1TV35/ieLPALMAUU284jwtecm+r3Y++/ltDt6AxPP6F84ZuQVqXvsnTX6uqS0btO2OgJfkU8KoRu34f2LM8wJI8XVXfdR8tyeaqOpzkNcD9wLVV9R+nq3tBXllvzLWn7W0t2/fE/qFb0Bje8urLh25BWpc+Vfc+VFUzo/ZtONMfrqo3n2pfkv9KMr3skuORUxzjcPf1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JDk0SSPJHnP0D31Jcn3Jfm3JA935/YHQ/d0NiSZSvLvST45dC99S/LVJF/sHvk3P3Q/fUtyYZJ7k3w5yWNJ3jRoP+v9HlqSKeBx4DpgEXgQuKmqHh20sZ4kuRo4Dtw96mcE17ok08B0VX0+yQ8ADwE/18L3r5sZfH7385sbgX8B3lNVnx24tV4l+S1gBrigtcfjJfkqMFNVTf7QeJI9LD3WcFeSc4DzqurrQ/XjJzTYDixU1cGqeha4B9g5cE+9af2xZFX1ZFV9vlv+JvAYsHnYrvpRS453qxu7V1P/A02yBfhZYNfQveh7k+QVwNXAXQBV9eyQYQYGGiy9+R1atr5II2+I6033tJorgM8N20l/ustx+4EjwH1V1cy5df4U+B3gO0M3cpYU8E9JHuoe7deSy4CngL/sLhnvSnL+kA0ZaGpCkpcDHwN+o6q+MXQ/famq56rqcmALsD1JM5eNk7wNOFJVDw3dy1n0U1V1JXA98O7uFkArNgBXAh+oqiuA/wYGnYNgoMFhYOuy9S3dNq0R3f2ljwEfrqq/G7qfs6G7lPMAsGPoXnp0FXBDd5/pHuCnk/z1sC31q6oOd1+PAB9n6RZHKxaBxWVXDe5lKeAGY6AtTQLZluSy7qbmjcDcwD3pReomTtwFPFZVfzx0P31KckmSC7vl72dp4tKXh+2qP1V1W1VtqapLWfp3d39V/eLAbfUmyfndRCW6S3E/AzQz27iq/hM4lOS13aZrgUEnY03y18esSlV1IsktwD5gCtg96lfbrFWjHktWVXcN21WvrgJ+Cfhid68J4Pe6h2CvddPAnm4m7suAv62q5qa2N+wHgY93j7HdAPxNVf3jsC317teAD3cfBg4C7xyymXU/bV+S1AYvOUqSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmvD/jKIBKLd4Le0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "batch, N, C = 3, 7, 2\n",
    "\n",
    "# batch, N, z_n, z_n_1\n",
    "log_potentials = torch.rand(batch, N, C, C)\n",
    "dist = torch_struct.LinearChainCRF(log_potentials, lengths=torch.tensor([N-1, N, N+1]))\n",
    "show_chain(dist.argmax[0])\n",
    "plt.show()\n",
    "show_chain(dist.argmax[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAK4UlEQVR4nO3df6xfd13H8eeL23a44X64Tihts3XYLBI1brupmpGlccxsSFajmGxGHURSYjZEjdFNkxH5a+4Pf0UCNl1lQ2CYMfRKGufIRtAQcB0U94vCtcH01mGhHduKStPx9o97utxdv21nv+d7T++nz0fyzfd8zvn0fN4nTe+r33M+389NVSFJ0nL3qqELkCSpDwaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQljBVqSH0jyUJKvde8XHKffi0l2d6+ZccaUJGmUjPM9tCR3AYeq6s4ktwEXVNXvjeh3uKpeM0adkiSd0LiBtgfYXFXPJFkDfKaqLhvRz0CTJE3UuIH27ao6v9sO8Oyx9qJ+R4HdwFHgzqr62+OcbyuwFSBnrbxy1dqLTrm2093Zq44MXcJEXbrqhaFLmKjZ7547dAkT84Mrnx+6hIn6xhNnD12CxvACz36rqkaGw4qT/eEknwZeN+LQHyxsVFUlOV46XlxV+5NcCjyc5PGq+rfFnapqG7AN4NVvWFsX3/Wuk5W3bF3++rmhS5ioj254ZOgSJurnZ68duoSJuWXtw0OXMFF3veFHhy5BY/h03f/vxzt20kCrqjcf71iS/0yyZsEtxwPHOcf+7n1vks8AlwP/J9AkSTpV407bnwFu7rZvBv5ucYckFyQ5q9teDVwFPDXmuJIk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8uXu2v5w6JomIclUki8l+dTQtfQtydeTPN4t+bdr6Hr6luT8JPcn+UqSp5P81KD1nOnP0JJMAV8FrmX+i9+PAjdV1VODFtaTJFcDh4F7R31HcLlLsgZYU1VfTPL9wGPAz7Xw99fNDD6n+/7mSuCfgfdU1ecHLq1XSX4bmAbObW15vCRfB6arqskvVie5h/llDbcnWQWcXVXfHqoeP6HBJmC2qvZW1RHgPmDLwDX1pvVlyarqmar6Yrf9AvA0sHbYqvpR8w53zZXdq6n/gSZZB/wssH3oWvT/k+Q84GrgboCqOjJkmIGBBvM//PYtaM/RyA/EM023Ws3lwBeGraQ/3e243cAB4KGqaubaOn8K/C7wvaELmZAC/jHJY93Sfi3ZAHwT+KvulvH2JOcMWZCBpiYkeQ3z64X+ZlU9P3Q9famqF6vqx4F1wKYkzdw2TvJW4EBVPTZ0LRP0pqq6ArgeuKV7BNCKFcAVwAeq6nLgO8CgcxAMNNgPrF/QXtft0zLRPV/6BPCRqnpg6HomobuV8whw3dC19Ogq4IbuOdN9wE8n+ethS+pXVe3v3g8An2T+EUcr5oC5BXcN7mc+4AZjoM1PAtmYZEP3UPNGYGbgmvQKdRMn7gaerqo/HrqePiW5KMn53fb3MT9x6SvDVtWfqrq9qtZV1SXM/7t7uKp+eeCyepPknG6iEt2tuJ8BmpltXFXfAPYluazbdQ0w6GSsvn7B57JVVUeT3Ao8CEwBO0b9apvlatSyZFV197BV9eoq4FeAx7tnTQC/3y2CvdytAe7pZuK+CvibqmpuanvDXgt8slvGdgXw0ar6h2FL6t27gY90Hwb2Au8Yspgzftq+JKkN3nKUJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNcFAkyQ1wUCTJDXhfwEszw/FNNBCzQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/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Svpn4DTbIG+Glg+9C16P8nyXnAlcDtAFV1ZMgwAwMNZn/47ZvTnqGRH4hnmm61mo3AF4etpD/d7bhdwAHgvqpq5to6vw/8GvDdoQsZkwL+LsnD3dJ+LVkPfAP4s+6W8fYk5wxZkIGmJiR5NbPrhX6gqp4fup6+VNULVfUjwBpgU5JmbhsneRtwoKoeHrqWMfrJqrocuAZ4b/cIoBXLgcuBD1fVRuC/gEHnIBhosB9YO6e9ptunJaJ7vvRp4GNV9Zmh6xmH7lbOA8CWoWvp0RXAtd1zpruAn0ryF8OW1K+q2t99PQB8ltlHHK2YAWbm3DW4m9mAG4yBNjsJZEOS9d1DzeuAqYFr0svUTZy4HXi8qn536Hr6lOSiJOd3269iduLSE8NW1Z+qurmq1lTVOmb/391fVT83cFm9SXJON1GJ7lbcW4BmZhtX1X8A+5Jc1u26Chh0MlZff+Bzyaqqo0luBO4FlgE7Rv1pm6Vq1LJkVXX7sFX16grgncAj3bMmgN/oFsFe6lYDd3Qzcc8CPlVVzU1tb9j3Ap/tlrFdDny8qv522JJ69z7gY92bgb3Au4cs5oyfti9JaoO3HCVJTTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU0w0CRJTfhfFUgWcrqt8c4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_chain(dist.marginals[0])\n",
    "plt.show()\n",
    "show_chain(dist.marginals[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "def show_samples(samples):\n",
    "    show_chain(samples[0, 0])\n",
    "    plt.show()\n",
    "    show_chain(samples[1, 0])\n",
    "    plt.show()\n",
    "    show_chain(samples[0, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAA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w3bSn+5y3D7gMHBfVTVzbp0/AX4b+M7QjZwmBfxTkoe6R/u15DLgKeAvukvGO5OcP2RDBpqakOSVwMeBX6+qbwzdT1+q6rmquhzYDGxL0sxl4yRvBw5X1UND93Ia/WRVXQlcD7ynuwXQimngSuCDVXUF8N/AoHMQDDQ4BGxZsb6526Z1oru/9HHgI1X1t0P3czp0l3IeALYP3UuPrgJu6O4z3QP8VJK/GralflXVoe7rYeATLN/iaMUSsLTiqsG9LAfcYAy05UkgW5Nc1t3UvBGYH7gnvUTdxIm7gMeq6o+G7qdPSS5JcmG3/L0sT1z68rBd9aeqbquqzVV1Kcs/d/dX1S8M3FZvkpzfTVSiuxT300Azs42r6j+Bg0le1226Fhh0MtYk/3zMGamqjie5BdgLTAG7Rv1pm/Vq1GPJququYbvq1VXALwJf7O41Afxu9xDs9W4G2N3NxH0F8DdV1dzU9oZ9P/CJ7jG208BfV9U/DttS734V+Ej3ZuAA8K4hmznrp+1LktrgJUdJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhP+H6ddAShP6eXNAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrUlEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pfc7+n93Ocj+eaeH5+e9/ukt/fV7zmf77mpKiRJWuteNnQDkiT1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/amq26pqS1VdytK/u/ur6hcHbqs3Sc7vJirRXYr7GaCZ2cZV9Z/AoSSv7TZdCww6GWuSvz7mrFRVJ5LcAuwDpoDdo361zVo16rFkVXXXsF316irgl4AvdveaAH6vewj2WjcN7Olm4r4M+Nuqam5qe8N+EPh49xjbDcDfVNU/DttS734N+HD3ZuAg8M4hm1n30/YlSW3wkqMkqQkGmiSpCQaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQn/D0qVAShbU0+IAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKkklEQVR4nO3df6xfdX3H8efL2wIDpzBLZqWNsNjozNwAb7oZFkKGzKKGLtElkGxDM3MTI5vTLBtsCWb+xfbHfmVG05RO2FQ0dW53prGDgNFlUbm4IgIW7xqX3ooWW0S7H7Lie3/cU3a5+94W+z39nt5Pn4/km3t+fHre75Pb3le/53y+56aqkCRptXvB0A1IktQHA02S1AQDTZLUBANNktQEA02S1AQDTZLUhLECLclPJLk7yde7rxesMO6ZJHu61+w4NSVJGiXjfA4tyZ8Ah6vqtiQ3AxdU1e+PGHekql44Rp+SJB3XuIG2F7iqqh5Psh74bFW9csQ4A02SdEqNG2jfrarzu+UATx5bXzbuKLAHOArcVlV/v8LxZoAZgPPOzWtf9YqzTro3SRrlsa+cO3QLGsP3efI7VXXhqH1rTvSHk9wDvHTErj9culJVlWSldHx5VR1I8lPAvUkeqqp/Wz6oqrYB2wCmf+6c+tLujSdqT5J+JG942aVDt6Ax3FM7/32lfScMtKp6/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+lOTB7tz+aOieToUkU0n+Ncmnh+6lb0m+keSh7pF/c0P307ck5yfZmeRrSR5N8rpB+znT76ElmQIeA64BFoD7gRuq6pFBG+tJkiuBI8Cdoz4juNolWQ+sr6ovJ/lx4AHgV1r4/nUzg8/rPr+5Fvhn4N1V9YWBW+tVkvcC08CLWns8XpJvANNV1eSH4pPcweJjDbcnOQs4t6q+O1Q/vkODzcB8Ve2rqqeBu4CtA/fUm9YfS1ZVj1fVl7vl7wOPAhcN21U/atGRbnVt92rqf6BJNgBvArYP3Yt+NEleDFwJ3A5QVU8PGWZgoMHiD7/9S9YXaOQH4pmme1rNZcAXh+2kP93luD3AQeDuqmrm3Dp/Dvwe8MOhGzlFCvinJA90j/ZrySXAE8Bfd5eMtyc5b8iGDDQ1IckLgU8Cv1NV3xu6n75U1TNVdSmwAdicpJnLxkneDBysqgeG7uUU+sWquhy4FnhXdwugFWuAy4EPVtVlwH8Ag85BMNDgALBxyfqGbptWie7+0ieBj1TV3w3dz6nQXcq5D9gydC89ugK4rrvPdBfwS0n+dtiW+lVVB7qvB4FPsXiLoxULwMKSqwY7WQy4wRhoi5NANiW5pLupeT0wO3BPep66iRO3A49W1Z8O3U+fklyY5Pxu+cdYnLj0tWG76k9V3VJVG6rqYhb/3d1bVb82cFu9SXJeN1GJ7lLcLwPNzDauqm8B+5O8stt0NTDoZKxJ/vqY01JVHU1yE7AbmAJ2jPrVNqvVqMeSVdXtw3bVqyuAXwce6u41AfxB9xDs1W49cEc3E/cFwCeqqrmp7Q37SeBT3WNs1wAfrarPDNtS734L+Ej3ZmAf8PYhmznjp+1LktrgJUdJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhP+F513+Qs1qCC1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_samples(dist.sample((10,)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKvElEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pf0e+793Ocj+eaeH5+e9/vkfntf/Z7zuaepKiRJWuteNnQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNWGsQEvyyiT3JflK9/WiU4x7Lsn+7jU3Tk1JkkbJOL+HluSPgGNVdUeSW4GLqup3R4w7XlUvH6NPSZJOa9xAOwBcU1VPJpkGPl1Vrx0xzkCTJJ1V4wba16vqwm45wNMn11eMOwHsB04Ad1TV35/ieLPALMAUU284jwtecm+r3Y++/ltDt6AxPP6F84Zu4axp/b3Z8vduPfgmT3+tqi4Zte+MgZbkU8CrRuz6fWDP8gBL8nRVfdd9tCSbq+pwktcA9wPXVtV/nK7uBXllvTHXnra3tWzfE/uHbkFjeMurLx+6hbOm9fdmy9+79eBTde9DVTUzat+GM/3hqnrzqfYl+a8k08suOR45xTEOd18PJvk0cAVw2kCTJOl7Me60/Tng5m75ZuAfVg5IclGSc7vlTcBVwKNj1pUk6QXGDbQ7gOuSfAV4c7dOkpkku7oxPwbMJ3kYeICle2gGmiSpV2e85Hg6VXUU+K4bXVU1D7yrW/5X4CfGqSNJ0pn4pBBJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVITDD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Zr6F2iSLcDPAruG7kXfmySvAK4G7gKoqmeHDDMw0GDph9+hZeuLNPIDcb3pnlZzBfC5YTvpT3c5bj9wBLivqpo5t86fAr8DfGfoRs6SAv4pyUPdo/1achnwFPCX3SXjXUnOH7IhA01NSPJy4GPAb1TVN4bupy9V9VxVXQ5sAbYnaeaycZK3AUeq6qGhezmLfqqqrgSuB97d3QJoxQbgSuADVXUF8N/AoHMQDDQ4DGxdtr6l26Y1oru/9DHgw1X1d0P3czZ0l3IeAHYM3UuPrgJu6O4z3QP8dJK/HralflXV4e7rEeDjLN3iaMUisLjsqsG9LAXcYAy0pUkg25Jc1t3UvBGYG7gnvUjdxIm7gMeq6o+H7qdPSS5JcmG3/P0sTVz68rBd9aeqbquqLVV1KUt/7+6vql8cuK3eJDm/m6hEdynuZ4BmZhtX1X8Ch5K8ttt0LTDoZKxJ/vcxq1JVnUhyC7APmAJ2j/qvbdaqUY8lq6q7hu2qV1cBvwR8sbvXBPB73UOw17ppYE83E/dlwN9WVXNT2xv2g8DHu8fYbgD+pqr+cdiWevdrwIe7DwMHgXcO2cy6n7YvSWqDlxwlSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU34f4mjByhWlIcCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKuElEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvou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n7gIeq6o/HrqfPiW5JMmF3fL3szRx6cvDdtWfqrqtqrZU1aUsfd/dX1W/OHBbvUlyfjdRie5S3M8Azcw2rqr/BA4leW236Vpg0MlYk/zvY9akqjqR5BZgHzAF7B71X9usV6MeS1ZVdw3bVa+uAn4J+GJ3rwng97qHYK9308Cebibuy4C/rarmprY37AeBj3ePsd0A/E1V/eOwLfXu14APdx8GDgLvHLKZs37aviSpDV5ylCQ1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNcFAkyQ14f8BCCcHKApMmh4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKqUlEQVR4nO3df6xfd13H8eeL22664dhYF7m01Y1YiUTJNm6KZGZZHJMOyWoiJluiDiK5iWGKGqObJiPy1/QPf0UCWbpKp8gwQ/RCGuvIRtAYcHfYAdvouDYkvd20ox2DijI73v5xT5e7y7ft2Pf0e+793Ocj+eaeH5+e9/vktt9Xv+d87rmpKiRJWuteNnQDkiT1wUCTJDXBQJMkNcFAkyQ1wUCTJDXBQJMkNWGsQEvyyiT3JflK9/WiU4x7Lsn+7jU3Tk1JkkbJOD+HluSPgGNVdUeSW4GLqup3R4w7XlUvH6NPSZJOa9xAOwBcU1VPJpkGPl1Vrx0xzkCTJJ1V4wba16vqwm45wNMn11eMOwHsB04Ad1TV35/ieLPALMAUU284jwtecm+r3Y++/ltDt6AxPP6F84ZuQVqXvsnTX6uqS0btO2OgJfkU8KoRu34f2LM8wJI8XVXfdR8tyeaqOpzkNcD9w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      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "show_samples(dist.topk(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([256, 3, 7, 2, 2])\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKe0lEQVR4nO3df4xeVZ3H8ffHtoDgImiJVtoIxsYfWXcBJ1XDhpBF1uIaaqImkKyLZs0kRtTVGEVNNPoXu3+4ajSapnSFXRVNXXU0RISAUbNRGdwiAhbHRtOprMUW0foLi1//mFsyjM+02Od2buf0/UqezD33nt7zPWk6n957z9xJVSFJ0nL3uKELkCSpDwaaJKkJBpokqQkGmiSpCQaaJKkJBpokqQljBVqSJyW5KckPu6+nL9Lv4STbu8/UOGNKkjRKxvk5tCT/DuyrqquTXAWcXlXvGNFvf1U9YYw6JUk6pHEDbQdwYVXdl2QN8LWqetaIfgaaJOmoGjfQflFVp3XbAR442F7Q7wCwHTgAXF1VX1jkfJPAJMApJ+f5z37mCUdcmySNcu/3Th66BI3hVzzw86o6Y9SxlYf7w0luBp464tC75zeqqpIslo5Pr6rdSZ4B3JLkzqr60cJOVbUZ2Aww8bcn1XduXHe48iTpL/KSp50zdAkaw8217SeLHTtsoFXVixc7luRnSdbMu+W4Z5Fz7O6+7kzyNeBc4M8CTZKkIzXusv0p4Ipu+wrgiws7JDk9yYnd9mrgfODuMceVJOlRxg20q4GLk/wQeHHXJslEki1dn+cA00nuAG5l7hmagSZJ6tVhbzkeSlXtBS4asX8aeF23/b/A88YZR5Kkw/FNIZ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MV8E3gzVX1rYFL61WStwITwKmtvR4vyY+Biapq8gerk1zL3GsNtyQ5ATi5qn4xVD1eocEGYKaqdlbVQ8D1wKaBa+pN668lq6r7quq73favgHuAM4etqh81Z3/XXNV9mvofaJK1wD8CW4auRX+ZJE8ELgCuAaiqh4YMMzDQYO6b36557Vka+YZ4vOneVnMu8O1hK+lPdztuO7AHuKmqmplb54PA24E/Dl3IUVLAV5Pc3r3aryVnA/cD/9ndMt6S5JQhCzLQ1IQkTwA+B/xrVf1y6Hr6UlUPV9U5wFpgQ5JmbhsneRmwp6puH7qWo+jvquo84BLgDd0jgFasBM4DPlZV5wK/BgZdg2CgwW5g3bz22m6flonu+dLngE9W1f8MXc/R0N3KuRXYOHQtPTofuLR7znQ98PdJ/nvYkvpVVbu7r3uAzzP3iKMVs8DsvLsG25gLuMEYaHOLQNYnObt7qHkZMDVwTXqMuoUT1wD3VNUHhq6nT0nOSHJat/145hYu/WDYqvpTVe+sqrVVdRZz/+5uqap/Gris3iQ5pVuoRHcr7h+AZlYbV9X/A7uSPKvbdREw6GKspfz1McekqjqQ5ErgRmAFsHXUr7ZZrka9lqyqrhm2ql6dD7wauLN71gTwru4l2MvdGuDabiXu44DPVlVzS9sb9hTg891rbFcCn6qqrwxbUu/eCHyyuxjYCbx2yGKO+2X7kqQ2eMtRktQEA02S1AQDTZLUBANNktQEA02S1AQDTZLUBANNktSEPwFWAPQ606eZywAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKk0lEQVR4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ks59wFbhu6lR1cA13X3me4CfiHJXw/bUr+q6kD39SDwKRZvcbRiAVhYctVgJ4sBNxgDbXESyKYkl3Q3Na8HZgfuSc9TN3HiduDRqvqTofvpU5ILk5zfLf8YixOXvj5sV/2pqluqakNVXcziv7t7q+pXBm6rN0nO6yYq0V2K+0WgmdnGVfXvwP4kr+o2XQ0MOhlrkr8+5rRUVUeT3ATsBqaAHaN+tc1qNeqxZFV1+7Bd9eoK4B3AQ929JoDf7x6CvdqtB+7oZuK+APjbqmpuanvDfgL4VPcY2zXA31TVPwzbUu9+HfhY92ZgH/DuIZs546ftS5La4CVHSVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVIT/g8U8fkL8geUpAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pb2f+3wk39zz49Pzfp/c3vvq95zP9zRVhSRJq91Lhm5AkqQ+GGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJowVaEl+KMk9Sb7Wfb3oFOOeTbK/e82OU1OSpFEyzufQkvwpcKyqbk9yC3BRVf3BiHHHq+qlY/QpSdJpjRtoB4Crq+qJJBuBT1XVa0aMM9AkSStq3ED7ZlVd2C0HeOrk+rJxJ4D9wAng9qr6x1McbwaYAbjg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gSZJaoKBJklqgoEmSWqCgSZJaoKBJklqgoEmSWrC/wHB0AMcvTlv9wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKjklEQVR4nO3df6xfd13H8eeL225zQ9iki5S1YTM0IPHHNm6qZGZZHJMOyUoiJFuCDiK5iWGKGqObJiPy1/QPf0UCabrKpsgwRfRKGuqWjaAhwO6wY2yj49pgesu0ox2D+oPZ8faPezq/u35vO/s9vaf3c5+P5Jt7fnx63u+Tm95Xzzmfe5qqQpKk1e4lQzcgSVIfDDRJUhMMNElSEww0SVITDDRJUhMMNElSEyYKtCQ/kOTeJF/rvl60zLjnkuzrPrOT1JQkaZxM8ntoSX4fOFpVdyS5Fbioqn5rzLhjVfXSCfqUJOmkJg20/cA1VfVkko3AZ6rqtWPGGWiSpDNq0kD7VlVd2C0HePrE+pJxx4F9wHHgjqr6m2WONwPMAFxwft7wutecc9q9SWfSE18+f+gWpDXpOzz9zaq6eNy+daf6w0nuA145ZtfvjK5UVSVZLh1fXVWHkvwQcH+SR6rqn5cOqqodwA6A6R8/r764d/Op2pMG8eZXXT50C9KadF/t/pfl9p0y0KrqTcvtS/JvSTaO3HI8vMwxDnVfDyT5DHAF8H8CTZKk0zXptP1Z4OZu+Wbgb5cOSHJRknO75Q3AVcBjE9aVJOkFJg20O4DrknwNeFO3TpLpJDu7MT8MzCV5GHiAxWdoBpokqVenvOV4MlV1BLh2zPY54D3d8ueAH52kjiRJp+KbQiRJTTDQJElNMNAkSU0w0CRJTT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22AvNVdaCqngXuAbYP3FNvWn8tWVU9WVVf6pa/AzwOXDJsV/2oRce61fXdp6l/gSbZBPwssHPoXvT/k+TlwNXAnQBV9eyQYQYGGiz+8Ds4sr5AIz8Q15rubTVXAF8YtpP+dLfj9gGHgXurqplz6/wR8JvA94Zu5Awp4O+TPNS92q8llwFPAX/W3TLemeSCIRsy0NSEJC8FPgH8alV9e+h++lJVz1XV5cAmYGuSZm4bJ3krcLiqHhq6lzPop6rqSuB64L3dI4BWrAOuBD5UVVcA/w4MOgfBQINDwOaR9U3dNq0S3fOlTwAfraq/HrqfM6G7lfMAsG3oXnp0FXBD95zpHuCnk/zFsC31q6oOdV8PA59k8RFHKxaAhZG7BrtZDLjBGGiLk0C2JLmse6h5IzA7cE96kbqJE3cCj1fVHwzdT5+SXJzkwm75+1icuPTVYbvqT1XdVlWbqupSFv/e3V9V7xy4rd4kuaCbqER3K+5ngGZmG1fVvwIHk7y223QtMOhkrJX872POSlV1PMktwF5gCtg17r+2Wa3GvZasqu4ctqteXQX8PPBI96wJ4Le7l2CvdhuBu7qZuC8B/qqqmpva3rAfBD7ZvcZ2HfCXVfXpYVvq3S8DH+0uBg4A7x6ymTU/bV+S1AZvOUqSmmCgSZKaYKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmvA/OaX5C9/BKD0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZisiXqIJKbG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egT4BIu3OFqxACwsuWqwh8WAG4yBtjgJZGuSy7ubmjcBswP3pJeomzhxN/B4Vf3x0P30KcmlSS7ulr+HxYlLXx62q/5U1e1VtbmqLmPx390DVfWLA7fVmyQXdROV6C7F/QzQzGzjqvoP4FCS13WbrgMGnYw1yV8fsypV1YkktwL7gClg16hfbbNWjXosWVXdPWxXvboa+CXgi929JoDf6x6CvdZtBHZ3M3FfBvxNVTU3tb1h3w98onuM7TrgI1X1j8O21LtfAz7cvRk4CLxzyGbO+Wn7kqQ2eMlRktQEA02S1AQDTZLUBANNktQEA02S1AQDTZLUBANNktSE/wNmvwMcMpkL5wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKt0lEQVR4nO3df6xfdX3H8efL2wKCU5gls7bNYLFzM5sDvOlmWAgZMoszdIkugWSKRnMTI85tWTbYEsz8i+2P/cqMhpTOsqm41LndmcYOAsYZo3LRogIWr41Jb2Ertoh2brLie3/cU3K5+7ZFvud+T++nz0fyzT0/Pj3v98m3va9+z/ncc1NVSJK02r1g6AYkSeqDgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqwliBluQnk9yV5Jvd1wtOMO7pJHu71+w4NSVJGiXj/Bxakj8HjlTVrUluAi6oqj8aMe5oVb1ojD4lSTqpcQNtH3BlVT2WZD3wmap65YhxBpokaUWNG2jfrarzu+UATxxfXzbuGLAXOAbcWlX/fILjzQAzAOedm9f83CvOet69aViPfPXcoVtYUT/76h8M3cKKaf290+r2fZ74TlVdOGrfKQ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QaaJKkJ/wfA0wcUxG4uWgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrElEQVR4nO3df6xfd13H8eeL225zQ9igi5S2cTNUhChu46ZCZpbFMemQrCZisiXCIJCbGKaoMbppMiJ/Df/wVySQpat0CgxTRK+ksW7ZCBoD7A46YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd/Z77Pb2fPh/JN/f8+PS83yf3x6vfcz733FQVkiStdi8augFJkvpgoEmSmmCgSZKaYKBJkppgoEmSmmCgSZKaMFagJXlZknuSfKP7eNEJxj2bZG/3mh2npiRJo2Sc30NL8sfAkaq6PcktwEVV9fsjxh2tqheP0ackSSc1bqDtA66uqieSrAc+W1WvHjHOQJMkrahxA+3bVXVhtxzgqePry8YdA/YCx4Dbq+rvT3C8GWAG4ILz8/qfetU5p92bhvXYV84fugWdpp983feGbmFF+bW5un2Xp75VVReP2nfKQEtyL/CKEbv+ENi5NMCSPFVV/+8+WpINVXUwyU8A9wHXVNW/n6zu9M+eV1/cs+mkvenM9eZXXjZ0CzpNex7fO3QLK8qvzdXt3tr1YFVNj9q35lT/uKredKJ9Sf4zyfollxwPneAYB7uP+5N8FrgcOGmgSZL0wxh32v4scFO3fBPwD8sHJLkoybnd8jrgSuCRMetKkvQ84wba7cC1Sb4BvKlbJ8l0ku3dmNcAc0keAu5n8R6agSZJ6tUpLzmeTFUdBq4ZsX0OeE+3/G/Az4xTR5KkU/FJIZKkJhhokqQmGGiSpCYYaJKkJhhokqQmGGiS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herk+xk8bGG25OcA5xfVd8eqh/focEWYL6q9lfVM8DdwLaBe+pN648lq6onqupL3fJ3gUeBDcN21Y9adLRbXdu9mvofaJKNwC8B24fuRT+cJC8FrgLuBKiqZ4YMMzDQYPGH34El6ws08gPxbNM9reZy4AvDdtKf7nLcXuAQcE9VNXNunT8Dfg/4wdCNrJAC/jnJg92j/VpyKfAk8FfdJePtSS4YsiEDTU1I8mLgU8BvVdV3hu6nL1X1bFVdBmwEtiRp5rJxkrcCh6rqwaF7WUE/X1VXANcB7+1uAbRiDXAF8OGquhz4L2DQOQgGGhwENi1Z39ht0yrR3V/6FPCxqvq7oftZCd2lnPuBrUP30qMrgeu7+0x3A7+Q5G+GbalfVXWw+3gI+DSLtzhasQAsLLlqsIvFgBuMgbY4CWRzkku7m5o3ALMD96QXqJs4cSfwaFX9ydD99CnJxUku7JZ/hMWJS18ftqv+VNWtVbWxqi5h8fvuvqr6tYHb6k2SC7qJSnSX4n4RaGa2cVX9B3Agyau7TdcAg07GmuSfjzkjVdWxJDcDe4ApYMeoP22zWo16LFlV3TlsV726Eng78NXuXhPAH3QPwV7t1gM7u5m4LwL+tqqam9resB8DPt09xnYN8PGq+qdhW+rdbwAf694M7AfeNWQzZ/20fUlSG7zkKElqgoEmSWqCgSZJaoKBJklqgoEmSWqCgSZJaoKBJklqwv8B+cwDHANMYTkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKkElEQVR4nO3df6xfdX3H8efL2wIDpzBLZqWNsNj4I/sB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ruueM90F/FKSvxq2pX5V1YHu60Hg0yw+4mjFArCw5K7BThYDbjAG2uIkkE1JLukeal4PzA7ck56nbuLE7cCjVfXHQ/fTpyQXJjm/W/4xFicufX3YrvpTVbdU1YaqupjFv3f3VtXbBm6rN0nO6yYq0d2K+2WgmdnGVfXvwP4kr+w2XQ0MOhlrkv99zGmpqo4muQnYDUwBO0b91zar1ajXklXV7cN21asrgLcDD3XPmgB+r3sJ9mq3Hrijm4n7AuBvqqq5qe0N+0ng091rbNcAf11Vnx22pd79JvDx7mJgH/DOIZs546ftS5La4C1HSVITDDRJUhMMNElSEww0SVITDDRJUhMMNElSEww0SVIT/hdxofkL137AZwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKrklEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZgsiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+koW7ZCBIC7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd+577Pfd++nwk39zz49Pzfp/c3Pvq95zP99xUFZIkrXUvGboBSZL6YKBJkppgoEmSmmCgSZKaYKBJkppgoEmSmjBWoCX5oST3JPla9/WiU4x7Nsn+7jU7Tk1JkkbJOJ9DS/KnwLGquj3JLcBFVfUHI8Ydr6qXjtGnJEmnNW6gHQCurqonkmwEPlVVrxkxzkCTJK2ocQPtm1V1Ybcc4KmT68vGnQD2AyeA26vqH09xvBlgBuCC8/P6H3/1OS+6t9XusS+dP3QLK+rHX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RgMcTDRDtwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbQAAACSCAYAAAAttj/ZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAKuUlEQVR4nO3df6xfd13H8eeL225zQ9iki5S2cTNUlChu46ZKZpbFMemQrCZisiXqIJKbGKaoMbppMiJ/Tf/wVySQpat0CgxTRK+ksW7ZCBoD7A47YBsd14akt5t2tGNQUWbH2z/u6XJ3/bYd/Z77Pfd++nwk39zz49Pzfp/cb++r33M+9zRVhSRJa93Lhm5AkqQ+GGiSpCYYaJKkJhhokqQmGGiSpCYYaJKkJowVaEm+L8l9Sb7Sfb3kFOOeT7K/e82OU1OSpFEyzu+hJfkj4FhV3ZnkNuCSqvrdEeOOV9XLx+hTkqTTGjfQDgDXVtVTSTYCn6qq140YZ6BJklbUuIH29aq6uFsO8MzJ9WXjTgD7gRPAnVX1d6c43gwwA3DRhXnjD7/2vLPubbV74gsXDt3CivqhN3xr6BZ0llp/b2pt+ybPfK2qLh2174yBluR+4NUjdv0+sHtpgCV5pqr+3320JJuq6nCSHwQeAK6rqn8/Xd3pH7+gPrdvy2l7W8ve8porhm5hRe17cv/QLegstf7e1Np2f+15uKqmR+1bd6Y/XFVvPtW+JP+ZZOOSS45HTnGMw93Xg0k+BVwJnDbQJEn6bow7bX8WuKVbvgX4++UDklyS5PxueQNwNfDYmHUlSXqRcQPtTuD6JF8B3tytk2Q6yc5uzI8Ac0keAR5k8R6agSZJ6tUZLzmeTlUdBa4bsX0OeFe3/K/Aj41TR5KkM/FJIZKkJhhokqQmGGiSpCYYaJKkJhhok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CpoFXtPZ4vCRfBaarqslfrE6ym8XHGu5Mch5wYVV9fah+/IQG24D5qjpYVc8B9wI7Bu6pN60/lqyqnqqqz3fL3wQeBzYN21U/atHxbnV992rqX6BJNgM/C+wcuhd9d5K8ErgGuBugqp4bMszAQIPFH36Hlqwv0MgPxHNN97SaK4HPDttJf7rLcfuBI8B9VdXMuXX+FPgd4DtDN7JCCvinJA93j/ZryeXA08BfdpeMdya5aMiGDDQ1IcnLgY8Dv1FV3xi6n75U1fNVdQWwGdiWpJnLxkneBhypqoeH7mUF/VRVXQXcALy7uwXQinXAVcAHqupK4L+AQecgGGhwGNiyZH1zt01rRHd/6ePAh6vqb4fuZyV0l3IeBLYP3UuPrgZu7O4z3Qv8dJK/HralflXV4e7rEeATLN7iaMUCsLDkqsEeFgNuMAba4iSQrUku725q3gTMDtyTXqJu4sTdwONV9cdD99OnJJcmubhb/h4WJy59ediu+lNVt1fV5qq6jMW/dw9U1S8O3FZvklzUTVSiuxT3M0Azs42r6j+AQ0le1226Dhh0MtYk//uYVamqTiS5FdgHTAG7Rv3XNmvVqMeSVdXdw3bVq6uBXwK+2N1rAvi97iHYa91GYHc3E/dlwN9UVXNT2xv2/cAnusfYrgM+UlX/OGxLvfs14MPdh4GDwDuHbOacn7YvSWqDlxwlSU0w0CRJTTDQJElNMNAkSU0w0CRJTTDQJElNMNAkSU34P3paBxQ/vOAQAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Enumerate \n",
    "x,_ = dist.enumerate_support()\n",
    "print(x.shape)\n",
    "for i in range(10):\n",
    "    show_chain(x[i][0])\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f1877c52c18>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbwAAAChCAYAAAC8jwouAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAMX0lEQVR4nO3dbYxc5XnG8f+FjW2RQIJDZCxwA1Gtqk5aJWTlEFVNUHEkyAcbCZoatY1dgdwWoaaqKtUqEpXIF0jVtKqCFCyC4pAqQOgL28aI8pIoXwrFTQmJQY4X1Ai7BiekIkE0IDd3P8wh2iyz3tmd2Z1ln/9PWs15eXaee28f77XnnNFMqgpJkla608ZdgCRJS8HAkyQ1wcCTJDXBwJMkNcHAkyQ1wcCTJDVh9bgLmM2arK11vGXcZWjMXt3kMSD4lbO/P+4StEz8x5Ov/qCq3rmQ7122gbeOt/DBXDruMjRmR/7sg+MuQcvAv19527hL0DKxauPU9xb6vV7SlCQ1wcCTJDXBwJMkNcHAkyQ1wcCTJDXBwJMkNcHAkyQ1YajAS7I+yYNJjnSPZ59i7FlJjib57DBzSpK0EMOe4e0FHq6qzcDD3fpsPgV8Y8j5JElakGEDbwewv1veD1zRb1CSDwAbgH8dcj5JkhZk2MDbUFXHu+Xn6YXaz0lyGvBXwJ8OOZckSQs253tpJnkIOLfPrhumr1RVJak+464DDlTV0SRzzbUH2AOwjjPmKk2SpIHNGXhVtW22fUleSLKxqo4n2Qic6DPsQ8CvJ7kOeCuwJsnLVfWG+31VtQ/YB3BW1vcLT0mSFmTYT0uYBHYBN3eP980cUFW//fpykt3ARL+wkyRpMQ17D+9m4KNJjgDbunWSTCS5fdjiJEkalaHO8KrqReANH1pXVQeBa/ts/wLwhWHmlCRpIXynFUlSEww8SVITDDxJUhMMPElSEww8SVITDDxJUhMMPElSEww8SVITDDxJUhMMPElSEww8SVITDDxJUhMMPElSEww8SVITD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n6fVg99gKXiRJvkzvlWfnJDkK/AVwOkBVfQ44QO/VeVPAK8DvjafSxTNAD64C/jDJSeB/gZ0r7I8/6P0h/7vAt5M80W37c+AXoJljYZAezPtY8J1WJElNWE6XNCVJWjQGniSpCQaeJKkJBp4kqQkGniSpCQaeJKkJBp4kqQkGniSpCf8PzhUojkcVI4IAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 504x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(dist.entropy.detach().unsqueeze(0))"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
